End-to-end in detail
Detailed steps for the end-to-end process of verifying Celestia data inside a Mina smart contract
You can review the scripts/blobstream_example/e2e_blobstream_inclusion.sh
script to understand the end-to-end process in the example, but here it is broken down:
Preliminaries
Start by building the project.
Next, navigate to the scripts directory and create a new directory inside it where the end-to-end process will run.
Set environment variables for WORK_DIR
as a relative path within the scripts directory to the directory for the end-to-end process, and set RUN_DIR
as the fully-qualified path to the same directory. SetBLOB_DIR
as the fully-qualified path to the blob-stream-inclusion
repo directory where your SP1 proofs were generated.
Convert the SP1 blobstream proof
To prove the verification of the SP1 blobstream proof in o1js, we start by setting up the environment with the verification keys and public inputs of the SP1 blobstream proof. This can be done with the contracts/src/blobstream/sp1_to_env.ts
script.
This script does the following to set environment variables inside the $RUN_DIR/env.blobstream
file:
gets the public values from the SP1 proof, converts them to hex, and puts the result in
HEX_PI
gets the program verifier key from the first public input in the SP1 proof and puts it in
PROGRAM_VK
gets the hex-encoded SP1 proof, prepends it with 8 bytes of 0s and puts it in
HEX_PROOF
sets
WORK_DIR
andCACHE_DIR
to be used when we execute the proofs in the next step.
Now we're ready to run the PLONK proof:
This can take ~15 minutes. The output should look something like this:
All of the execution data is saved in a new directory in $RUN_DIR/blobstream
. The final proof is found at $RUN_DIR/blobstream/e2e_plonk/plonk/recursion/proofs/layer5/p0.json
.
Convert the SP1 blob inclusion proof
For converting the blob inclusion proof, we'll follow the same environment setup process as above with slightly modified parameters.
With the env.blobInclusion
file created, we can run the Plonk proof to convert our SP1 blob inclusion proof:
This can take ~15 minutes. The output should look the same as the blobstream proof conversion from the previous section.
All of the execution data is saved in a new directory in $RUN_DIR/blobInclusion
. The final proof is found at $RUN_DIR/blobInclusion/e2e_plonk/plonk/recursion/proofs/layer5/p0.json
.
Run the rollup contract example
Set up the environment
In order to prove the verification of the o1js proofs that verified the SP1 proofs in the previous step, the verifier keys for both SP1 programs are needed. The verifier key for the final compressed proof from the o1js proof & compression process above is also required. It's obtained from the public outputs of the layer 5 proof. (See the explanation of this flow for more detail about the proof compression.)
The verification scripts contracts/src/blobstream/verify_blobstream.ts
and contracts/src/blobstream/verify_blob_inclusion.ts
get these values from environment variables which can be set as follows:
Prove the verification of the blobstream proof
This should only take about a minute. Expected output:
Prove the verification of the blob inclusion proof
This should only take about a minute. Expected output:
Prove the correct execution of a batch
Expected output:
Run the example rollup contract
This should only take ~1 minute. Expected output:
Last updated