pub fn verify_batch_proof(
wrapper: ProofWrapper,
) -> Result<BatchResults, VerifyError>Expand description
Verifies a complete batch of proofs generated by the Bankai SDK
All data returned by this function is cryptographically guaranteed to be valid. Once verification succeeds, no further validation is required. This guarantee is provided by Bankai’s stateless light client architecture using STWO zero-knowledge proofs.
This is the main entry point for verifying proof bundles. It performs a complete verification of all proofs in the batch using a hierarchical approach:
- STWO Proof Verification: Verifies the zero-knowledge proof to establish trust in the MMR roots for execution and beacon chains
- Header Verification: Verifies all execution and beacon headers using MMR inclusion proofs against the trusted roots
- Account Verification: Verifies account proofs using Merkle Patricia Trie proofs against verified execution headers
- Transaction Verification: Verifies transaction proofs using MPT proofs against verified execution headers
§Arguments
wrapper- AProofWrappercontaining the STWO block proof and all individual proofs to verify. This is typically generated by thebankai-sdkcrate.
§Returns
Returns BatchResults containing all verified data:
- Verified execution headers with their block numbers and roots
- Verified beacon headers with their slot numbers
- Verified accounts with balances, nonces, and code hashes
- Verified transactions with their details
§Errors
Returns a VerifyError if any verification step fails:
InvalidStwoProof: The STWO zero-knowledge proof is invalidInvalidMmrProof: An MMR inclusion proof failedInvalidMmrRoot: MMR root mismatchInvalidHeaderHash: Header hash doesn’t match committed valueInvalidAccountProof: Account MPT proof failedInvalidTxProof: Transaction MPT proof failedInvalidStateRoot: State root mismatchInvalidExecutionHeaderProof: Referenced header not found
§Example
use bankai_verify::verify_batch_proof;
use bankai_types::fetch::ProofWrapper;
let results = verify_batch_proof(&proof_wrapper)?;
// Access verified execution headers
println!("Verified {} execution headers", results.evm.execution_header.len());
for header in &results.evm.execution_header {
println!("Block {}: hash {:?}", header.number, header.hash());
}
// Access verified accounts
println!("Verified {} accounts", results.evm.account.len());
for account in &results.evm.account {
println!("Balance: {}", account.balance);
}
// Access verified transactions
println!("Verified {} transactions", results.evm.tx.len());