Comments (2)
This seems to suggest to me that there is something wrong with the way pairings are computed in snarkjs.
Indeed there is a slight difference between the pairing implementations in libsnark and snarkjs, but both are correct. In fact, the final exponentiation (FE) is computed differently and the result should be different because of an exponent cofactor. In the current implementation of snarkjs, the FE is elt^((q^12-1)/r)
while in libsnark it is equal to elt^(2z * ( 6z^2 + 3z + 1 )*(q^12-1)/r
where z=4965661367192848881
is the seed of the alt-bn128 curve. You can always raise to a multiple of (q^12-1)/r
that is not divisible by r
and the pairing would be correct. The point to do so is to find a good LLL decomposition in q^i
-basis and use Frobenius maps instead of modular exponentiations (see [SAC:FueKnaRod11]).
I implemented this in this PR and it should fix your problem.
from snarkjs.
In the new version we are using the wasmcurves lib that uses the right pairing. Closing it.
from snarkjs.
Related Issues (20)
- Goldilocks support HOT 1
- "snarkJS: Error: Scalar size does not match" on Num2Bits HOT 7
- Use MIT license HOT 1
- crypto.randomBytes is not a function HOT 1
- Question about case in readme
- Weird behaviour if invalid inputs are set
- verbose `snarkjs setup`
- How to capture the output signal output by the circuit HOT 1
- How to verify whether a zkey belongs to a specific circuit or not in PLONK?
- [BUG] curve not properly terminated after usage in groth16Vk(zkey, fd, sections) and plonkVk(zkey), causing process hang HOT 1
- `groth16 setup` failure on large constraints: invalid array length Allocation failed - JavaScript heap out of memory
- Public Signals in circom code
- How to call verifier.sol after extracting the callData with exportSolidityCallData?
- snarkJS: Error: Scalar size does not match HOT 2
- snarkjs groth16 is undefined HOT 3
- Verifiers for NEAR protocol HOT 3
- snarkjs groth16 prove failed
- Switch from js-sha3 to audited noble-hashes HOT 2
- Is there a way to run snarkjs in a single thread?
- plonk setup failure on large constraints:Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snarkjs.