Guides
Proof Verification Guide

Proof Verification Guide

Convert plonky2 proof to groth16 proof

  • common_circuit_data.json
  • proof_with_public_inputs.json
  • verifier_only_circuit_data.json
  • Copy the three files generated in the previous step to the gnark-plonky2-verifier/testdata/mips directory.

    git clone https://github.com/zkMIPS/gnark-plonky2-verifier.git
    cd gnark-plonky2-verifier
    cp ../verifier/data/test_circuit/* testdata/mips

    Build the benchmark file.

    go build benchmark.go
    ./benchmark

    Generate the on chain verification contract.

    go build gnark_sol_caller.go
    ./gnark_sol_caller generate --outputDir hardhat/contracts

    Using verifier contract to verify proof.

    cp testdata/mips/snark_proof_with_public_inputs.json hardhat/test/
    cd hardhat
    npm i
    npx hardhat node

    Create a new terminal, navigate to your hardhat folder, and execute:

    npx hardhat test

    Deploy Verifier Contract

    Make sure to set your PRIVATE_KEY with Sepolia ETH and RPC_ADDRESS in the .env.example file and rename .env.example to .env

    npx hardhat ignition deploy ./ignition/modules/Verifier.js --network sepolia

    Call the contract to verify the proof.

    cd ..
    ./gnark_sol_caller verify [ADDRESS]

    Upon success, it will output the following information:

    2024/09/16 16:02:20 verify proof txHash: 0x21951f633853468326622581a453e922d0533989b67ccf466576a1845237aecf

    You can view the transaction details for the hash.

    Congrats! You have just deployed your first proof. You can try using your proof integrated with the use-cases (opens in a new tab) of ZKM.