There are 3 parts to operating BlobstreamX (or for that matter any ZK-based system):
With the Succinct Platform, once you write your circuit and operator script, the platform will take care of the prover and relayer parts of the system, which is what our current BlobstreamX
deployment does (https://alpha.succinct.xyz/celestia/blobstreamx). Our current setup uses the BlobstreamX operator script here, which sends requests to our platform for proving + relaying. The local mode of the operator script will generate proofs locally, which this document covers.
Succinct Platform Concepts
The Succinct Platform has a concept of "releases" and "deployments". A "release" takes a circuit and builds it, storing the relevant artifacts that are used for proof generation. A "deployment" is tied to a specific release and is simply a deployed verifier contract onchain for the particular circuit. Each deployment has a "function_id" and contract address. The contract address is the address of the deployed verifier and the function_id
is a unique identifier that the SuccinctGateway
(our onchain entrypoint) uses to identify a circuit.
Local proving is run with Docker to ensure that it is replicable on any machine. However, to generate Blobstream X proofs (which are computationally intensive) we recommend a large instance such as AWS EC2's r6a.16xlarge
.
Clone the BlobstreamX repo. You will use this repository to run the local prover continuously for a given chain. More instructions will be provided in a later section to run the local prover.
The operator script run with local
mode will generate proofs locally using the downloaded binaries. To configure it, set up the environment variables following .env.example
and make sure to set SUCCINCT_RPC_URL=local
which will generate proofs locally instead of sending requests to our platform.
Create a folder locally where you will download all the built circuit artifacts and dependencies.
Last updated: 04/03/24 (Ratan)
Download the built circuit binaries from S3 (circuits have compiled binaries to generate proofs). The Blobstream circuit binaries are ~30GB, so downloading might take a bit. You can also build the binaries locally, though this is not recommended (instructions in the Misc section).
Get the release ID's corresponding to the Celestia chain you want to prove from the table below.
Note: Header Range with batch size 1024 is used on Arbitrum and Base. Blobstream X on Mainnet (deployment TBA) will use batch size 2048.
Network | Type | Batch Size | Release ID | URL |
---|---|---|---|---|
Celestia Mainnet | Header Range | 1024 | c637ee72-f9cb-47ce-ae15-4b0d5d0e15df | https://alpha.succinct.xyz/celestia/blobstreamx/releases/33 |
Celestia Mainnet | Header Range | 2048 | 71fc43b9-2803-4f09-9134-84573f972ee1 | https://alpha.succinct.xyz/celestia/blobstreamx/releases/34 |
Celestia Mainnet | Next Header | - | 4992ff5a-9af4-4e71-8591-3cf7b6c07f5b | https://alpha.succinct.xyz/celestia/blobstreamx/releases/32 |
Mocha-4 Testnet | Header Range | 1024 | 044ac12a-e42f-406c-b64d-55c09ee5e2a6 | https://alpha.succinct.xyz/celestia/blobstreamx/releases/36 |
Mocha-4 Testnet | Next Header | - | f53a3885-ec02-4be7-bd37-bf70d29cd3c1 | https://alpha.succinct.xyz/celestia/blobstreamx/releases/35 |
Download the Blobstream X artifacts from S3 into your artifacts folder.
Mark the binaries as executable:
After these steps, you should have the following directory structure:
Get the HEADER_RANGE_FUNCTION_ID
and NEXT_HEADER_FUNCTION_ID
corresponding to the Blobstream X contract you are relaying proofs to. Go to Contract
-> Read as Proxy
-> {headerRangeFunctionId
, nextHeaderFunctionId
} to get the function IDs.
0x46132c86ed84fdc655528f80f9291dd3116b04902036b96925edc78bbf52b8ca
0x2ce8ca4f509cb09415b5a6ca6afa265571dac0b9f6ddb46f487e017fec71cf25
Set .env
in blobstreamx
to the following:
Make sure your Docker daemon is running & pull the latest succinct-local-prover
Then run the following to run the operator with local proof generation:
Proofs are stored as output_{request_id}.json
in the proofs/
folder. The local relayer will read this file to post proofs to the BlobstreamX smart contract.
On an AWS EC2 r6a.16xlarge
instance, header range proofs take ~25 mins to generate.
If you want to relay an existing proof in /proofs
, run the following command:
First, download the STARK-SNARK wrapper binary:
Instead of downloading the Blobstream X circuit binaries from a remote source, you can build them locally by running mkdir -p build && RUST_LOG=debug cargo run --bin header_range --release build && mv ./target/release/header_range ./build/header_range
at the top-level of the BlobstreamX repo. It is recommended you download the binaries directly instead of building locally, because you have to be careful that the build must be run with the exact same code as the deployed verifier, otherwise proofs will not generate properly.
You can test proof generation with your locally built circuits with the following command: LOCAL_PROVER=true RUST_LOG=info ./build/header_range prove input.json --wrapper-path ./verifier-build
.
The input.json
should be formatted like this and contain the bytes representation of the inputs to your circuit:
The generated proof will be stored at: output.json
in the folder you are running this command from. The output.json
looks something like this:
On our platform, a given proof request has all of the information above, including the input
bytes and output
. An example is here: https://alpha.succinct.xyz/explorer/d3aeb11c-9534-400e-987d-5dbbc195b0d0. You can get the output by clicking View
in the Output
section.
You should think of the SuccinctGateway
as a really simple router contract that uses deployed verifiers to verify proofs and also handle callbacks on contracts that use the proofs.
When you submit this transaction, the SuccinctGateway does the following steps:
function_id
to get the deployed verifier address and uses this address to verify the proofverifiedCall
(logic here) to update its own internal state.