Technical Details
Proof Generation and Verification
The ZK coprocessor generates and verifies proofs through several key components:
Proof Data Generation
The get_proof_data
functionality is central to the protocol's cross-chain operations:
Guest Program
Executes inside the RISC Zero zkVM
Verifies cross-chain state through zero-knowledge proofs
Validates user positions and market states across chains
Generates cryptographic proofs of state verification
Handles view calls to market contracts for state verification
Chain-Specific Verification
Each supported chain has specialized verification mechanisms:
Ethereum (L1)
Light client verification through beacon chain
Proof state via OPstack L1 reads
Optimism/Base (OpStack)
Sequencer commitment verification
Dispute game validation
L1 block inclusion proofs
Linea
Sequencer commitment verification
L1 block inclusion proofs
Self-Sequencing
While the Sequencer Infrastructure handles proof generation and submission for most users, the protocol maintains censorship resistance through self-sequencing capabilities. Users can generate and submit their own proofs if:
The Sequencer is unavailable
The Sequencer attempts to censor transactions
Users prefer to handle their own proof generation
Additional security guarantees are required
Self-Sequencing GuideTo generate proofs independently:
Setup
# Install RISC Zero zkVM and Bonsai SDK
For detailed installation instructions, see the [RISC Zero documentation](https://dev.risczero.com/api/zkvm/install).
Environment Configuration Create a
.env
file with required RPC endpoints:
RPC_URL_LINEA=
RPC_URL_ETHEREUM=
RPC_URL_BASE=
RPC_URL_OPTIMISM=
RPC_URL_BEACON=https://www.lightclientdata.org
# ... other chain configurations
Proof Generation Use the Malda SDK to generate proofs:
// Using Bonsai SDK for remote proving
pub async fn get_proof_data_prove_sdk(
users: Vec<Vec<Address>>,
markets: Vec<Vec<Address>>,
target_chain_ids: Vec<Vec<u64>>,
chain_ids: Vec<u64>,
l1_inclusion: bool,
) -> Result<MaldaProveInfo, Error>
// Using local zkVM for proving
pub async fn get_proof_data_prove(
users: Vec<Vec<Address>>,
markets: Vec<Vec<Address>>,
target_chain_ids: Vec<Vec<u64>>,
chain_ids: Vec<Vec<u64>>,
l1_inclusion: bool,
) -> Result<MaldaProveInfo, Error>
Transaction Preparation Extract the required data for on-chain submission:
let journal = Bytes::from(proof_info.receipt.journal.bytes);
let seal = risc0_ethereum_contracts::encode_seal(&receipt);
Note: For self-sequencing, l1_inclusion
must be set to true
to ensure additional security guarantees against potential reorg exploits.
Last updated