A Substrate-based chain supporting ZK-SNARK
(change Bellman's verifier to no_std
to adapt substrate)
you can use this verifier pallet
to verify the proof(uncompressed data) with bls12_381
curve
you should have known how to build a substrate-based chain.
build the chain:
cargo build --release
run the chain:
./target/release/node-template --dev --tmp
First, you need use this adapter to generate proof(proof_hex.json
) and verification(vkey_hex.json
).
i will show a minimal example with this circuit: a*b=c
.
- you can call the function
generate_proof_vkey
ofpallet-verifier
to storeproof
andverification key
(pass the hex data) - call the
verifier
function to verify the proof - attention to the
sp-std
version
You can verify all proofs generated by snarkjs with BLS12_381
through this pallet.