This contract verifies Raiko proofs generated by Sp1. To run the existing test:
$ cd ./provers/sp1/contracts
$ forge test
If compilation does not automatically add the dependency, do:
forge install foundry-rs/forge-std
The contract and proof is generated by ./provers/sp1/driver/src/gen_verifier.rs, which does the following things:
-
download smart contract artifacts of the
sp1-sdk
version in used (skip if exists) -
read ./provers/sp1/driver/.env for the following environment variables
# 'mock' for generating mock proofs locally, 'local' for generating proofs locally, 'network' for generating proofs using the proving network. SP1_PROVER=network # If using the proving network, set to your whitelisted private key. For more information, see: # https://docs.succinct.xyz/prover-network/setup.html#key-setup SP1_PRIVATE_KEY=your-private-key RUSTFLAGS='-C target-cpu=native' RUST_LOG=debug
-
generate proof given
GuestInput
in input.json either remotely or locally -
serealize the proof into fixture.json to be tested in
RaikoVerifier.sol
You can either start Raiko and run prove-block.sh to get the block you want from certain network and then run the run-verifier
to prove. Make sure the prover is not in mock
mode. Finally, you can verify with smart contract test.
$ TARGET=sp1 make run
$ ./script/prove-block.sh taiko_mainnet sp1 192317 192317 '
"proof_type": "sp1",
"sp1": {
"recursion": "plonk",
"prover": "network",
"verify": true
}
'
If you only need the json file of a block:
$ ./script/prove-block.sh taiko_mainnet native 192317 192317 '
"proof_type": "native",
"native": {
"json_guest_input": "./data/input-taiko-mainnet-192317.json"
}
'
And you can also call the smart contract verifier in a standalone binary which call forge test
internally:
$ cargo run --bin sp1-verifier -- input-taiko-mainnet-192317.json
You can also run ./script/sp1-e2e.sh which does the same thing:
$ ./script/sp1-e2e.sh taiko_mainnet 192317