Skip to content

VegeBun-csj/substrate-zk

Repository files navigation

substrate-zk

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

Build and Run

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

Test the zk-verifier

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 of pallet-verifier to store proof and verification key(pass the hex data)
  • call the verifier function to verify the proof
  • attention to the sp-std version

Advantage

You can verify all proofs generated by snarkjs with BLS12_381 through this pallet.

Releases

No releases published

Packages

No packages published