Open
Description
Hi,
I tried to follow the "Getting started" tutorial but no matter what I do to my circuit when proving I end up with [ERROR] snarkJS: Error: Scalar size does not match
.
Do I miss something here?
Here's a Dockerfile to be able to reproduce the issue and all the steps:
FROM node:20
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN git clone https://github.com/iden3/circom.git
WORKDIR /circom
RUN git checkout v2.1.9
RUN cargo build --release
RUN cargo install --path circom
RUN npm install -g snarkjs@0.7.4
WORKDIR /circuits
RUN cat <<EOF > ./multiplier.circom
pragma circom 2.0.0;
template Multiplier2() {
signal input a;
signal input b;
signal output c;
c <== a*b;
}
component main = Multiplier2();
EOF
RUN cat <<EOF > ./multiplier-input.json
{ "a": "2", "b": "3" }
EOF
# This is super slow to build in docker so I'm going to use the prebuilt one
# RUN snarkjs powersoftau new bn128 12 ./pot12_0000.ptau
# RUN snarkjs powersoftau contribute ./pot12_0000.ptau ./pot12_0001.ptau --name="First contribution"
RUN curl -O https://hermez.s3-eu-west-1.amazonaws.com/powersOfTau28_hez_final_08.ptau
RUN mkdir ./multiplier
RUN circom ./multiplier.circom \
--wasm \
--r1cs \
--O0 \
--sym \
--inspect \
-o ./multiplier
RUN snarkjs r1cs info \
./multiplier/multiplier.r1cs
RUN node ./multiplier/multiplier_js/generate_witness.js \
./multiplier/multiplier_js/multiplier.wasm \
./multiplier-input.json \
./multiplier/multiplier.wtns
RUN snarkjs powersoftau prepare phase2 \
./powersOfTau28_hez_final_08.ptau \
./multiplier/multiplier.ptau
RUN snarkjs groth16 setup \
./multiplier/multiplier.r1cs \
./multiplier/multiplier.ptau \
./multiplier/multiplier-0000.zkey
RUN snarkjs zkey contribute \
./multiplier/multiplier-0000.zkey \
./multiplier/multiplier.zkey \
--name="John Doe" \
-e="Random entropy"
RUN snarkjs zkey export verificationkey \
./multiplier/multiplier.zkey \
./multiplier/multiplier-verification-key.json
RUN snarkjs groth16 prove \
./multiplier/multiplier.zkey \
./multiplier/multiplier.wtns \
./multiplier/multiplier-proof.json \
./multiplier/multiplier-public.json
CMD snarkjs groth16 verify \
./multiplier/multiplier-verification-key.json \
./multiplier/multiplier-proof.json \
./multiplier/multiplier-public.json
Save this as "Dockerfile" file then build and run like this:
docker build -t zk-proofs .
docker run zk-proofs
Interestingly, running the prove/verify part from within the node script (not through CLI) works just fine.
Metadata
Metadata
Assignees
Labels
No labels