Steps
Steps to request sp1 proofs from kalypso.
1. Install SP1
2. Create a New Project
cargo prove new fibonacci
3. Inputs to Vec
Ensure all reads are of the Vec<u8>
type and no other type. You can read the data as Vec<u8>
and then deserialize it into the required type in the next step.
let inputs = sp1_zkvm::io::read::<Vec<u8>>();
if inputs.len() != 4 {
panic!("invalid inputs");
}
let n = u32::from_le_bytes(inputs.as_slice().try_into().unwrap());
stdin.write(&args.n.to_le_bytes().to_vec());
4. Prove Locally
cd script && RUST_LOG=info cargo run --bin prove --release
5. Push to GitHub
Ensure that the repo is structured in the standard template. Example: SP1 Project Template
6. Create a Market
If you are not proficient with creating a Market, message on Telegram, and someone can help do this for you.
7. Clone Request Template
https://github.com/marlinprotocol/sp1-request-template
npm i
8. Change the Market ID
Change the market ID to 21
for fib
. (If you have created your own market for the program in step 6, you will receive a unique market ID. Use that instead.)
9. Change Inputs
Remember encoding all inputs in your program to Vec<u8>
as shown here and before making the request, ensure that all inputs are encoded into contigous bytes as shown here.
10. Make a Request to Kalypso
npm run start
Wait for the proof link.
You can also check the onchain activity here: testnet
11. Download the Proof
The script will print the link to proof. Once the link is obtained, you can fetch it using
wget <link> -O proof
12. Verify Proof
Load the proof into verification script and verify.
let deserialized_proof = SP1Proof::load("./proof").expect("proof loading failed");
let client = ProverClient::new();
let (_, vk) = client.setup(FIBONACCI_ELF);
client.verify(&deserialized_proof, &vk).expect("verification failed");
println!("proof verification successful");
- Check SP1 dependency versions
- Kalypso uses 1.0.7-testnet
- Integrate at the end
- Encode inputs carefully