Skip to content
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

EdDSAPoseidonVerifier verification failed. #300

Closed
Subway2023 opened this issue Sep 26, 2024 · 2 comments
Closed

EdDSAPoseidonVerifier verification failed. #300

Subway2023 opened this issue Sep 26, 2024 · 2 comments

Comments

@Subway2023
Copy link

circuit.circom

include "../node_modules/circomlib/circuits/eddsaposeidon.circom";

template OwnershipProof() {
    // Signal definitions
    /** Private inputs */
    signal input note;
    signal input pub_key[2];
    signal input sig[3];
    component eddsa = EdDSAPoseidonVerifier();
    eddsa.enabled <== 0;
    eddsa.M <== note;
    eddsa.Ax <== pub_key[0];
    eddsa.Ay <== pub_key[1];
    eddsa.R8x <== sig[0];
    eddsa.R8y <== sig[1];
    eddsa.S <== sig[2];
}

component main = OwnershipProof();

input.json

{
    "note": "1234567890",
    "pub_key": [
        "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
        "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567891"
    ],
    "sig": [
        "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567892",
        "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567893",
        "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567894"
    ]
}

I followed the steps in Tutorial, but ultimately the verification failed.

snarkjs groth16 verify verification_key.json public.json proof.json

[ERROR] snarkJS: Error: Scalar size does not match
    at _multiExp (/root/.local/share/fnm/node-versions/v22.4.0/installation/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:4978:19)
    at WasmCurve.multiExpAffine (/root/.local/share/fnm/node-versions/v22.4.0/installation/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:5015:22)
    at groth16Verify$1 (/root/.local/share/fnm/node-versions/v22.4.0/installation/lib/node_modules/snarkjs/build/cli.cjs:6171:31)
    at async Object.groth16Verify [as action] (/root/.local/share/fnm/node-versions/v22.4.0/installation/lib/node_modules/snarkjs/build/cli.cjs:13017:21)
    at async clProcessor (/root/.local/share/fnm/node-versions/v22.4.0/installation/lib/node_modules/snarkjs/build/cli.cjs:483:27)
@Arvolear
Copy link
Contributor

Arvolear commented Oct 1, 2024

Hey, @Subway2023, you are getting this error because your circuit has no public signals. You can fix it by making the note signal public as this is the public data anyway.

Also, please check your inputs, as the values you provide are outside the curve's prime field.

@demonsh
Copy link

demonsh commented Oct 9, 2024

Hi @Subway2023
It was a bug in snarkjs.
This PR fix the issue iden3/ffjavascript#161
After next release of snarkjs the issue must be resolved.

@demonsh demonsh closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants