-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Support bandersnatch group #139
base: main
Are you sure you want to change the base?
WIP: Support bandersnatch group #139
Conversation
Awesome @dragan2234 !! Thanks a lot for the ping. This is looking good so far. You might need to impl |
Saving script for generating Z (SSVDW_Z) param:
Z returns 7,
|
All tests are passing :) . But I realized this is not exactly what we need, since this curve is generated in Short Weistrass form and we need Twisted Edwards form. Some explanation is in Sectio 6 of this paper: "6 Elliptic curves inside SNARKs" https://eprint.iacr.org/2022/586.pdf
This refers to R1CS but should be similar to plonkish arithmetization if i'm not mistaken? Also arkworks(besu uses this for verkle) and go-ipa(geth uses this for verkle) both use twisted edwards form. Found this repo: https://github.com/zkcrypto/jubjub . This implements jubjub in twisted edwards form, so I hope some parts can be reused if it's not too outdated? cc @CPerezz |
Hey @dragan2234 the main issue here will be that We can try to do some frankestein. But sounds a bit complex. In any case, I think we can for now porsue the |
@CPerezz Per my understanding halo2 as a proof system only needs bls12-381 traits for proving, here we need bandersnatch points in TE form where computation of point addition and scalar multiplication is done in circuit, which is not related to halo2 traits? That's if we do these computations in-circuit. If we need precomputations like wNAF and/or GLV that means we need these computation outside-of-circuit too but that's still not related to halo2 if my understanding is correct? |
That makes sense. Sounds good! |
Made some progress on the TE form of bandersnatch, still looking ugly and not working properly. Small comment regarding formulas for point addition (doubling etc.): JubJub has the parameter |
AFAIR if we have a twisted Edwards, we should go (out of circuit) for https://eprint.iacr.org/2008/522 which are complete formulas. These are the ones I implemented back in the days of BulletProofs in https://github.com/dusk-network/dusk-zerocaf |
Thanks, this helps! It's a bit confusing that https://github.com/zkcrypto/jubjub/blob/main/src/lib.rs#L127 uses t1 and t2. Also, I think we could simplify this by not implementing AffineNielsPoint and ExtendedNielsPoint, not sure if that's necessary. Your implementation and other implementations like https://github.com/jsign/verkle-crypto/blob/main/src/bandersnatch/points/extended.zig are much simpler. Will continue the work |
Point addition, doubling, subtraction and scalar multiplication are working fine. Implemented for ExtendedPoints trait (extended projective coordinates) and smoke tested against arkworks. File These should be enough for our purposes - testing against in-circuit implementation and building a precomputed table for in-circuit implementation. As a next step, I thought looking into: https://github.com/zhenfeizhang/halo2-native-ecc and trying to do the same with bandersnatch twisted edwards and getting some conclusions. cc @CPerezz |
Can this be implemented on top of #154 before BLS12381 comes? @dragan2234 |
1f65f1b
to
ca87ba3
Compare
This is being built on top of #87
Base field is taken from bls12-381, scalar field is built following bandersnatch paper https://eprint.iacr.org/2021/1152.pdf and other implementations. All tests are passing for short weistrass form. But we need twisted Edwards form, WIP.
cc @CPerezz just to keep you in the loop