Skip to main content

Cairo Circuit

The Cairo Circuit serves as the foundation for generating and verifying zero-knowledge proofs of Bitcoin transactions.

Diagram

Purpose and Functionality

The primary purpose of the Cairo Circuit is to create efficient and verifiable proofs of Bitcoin transactions.

  1. The Cairo Circuit takes Bitcoin transaction data as input and generates a zero-knowledge proof that attests to the validity of the transaction without revealing the transaction details.

  2. It provides a mechanism for verifying the generated proofs, allowing other components of the BeL2 system to confirm the validity of Bitcoin transactions without accessing the full Bitcoin blockchain.

  3. The compact nature of zero-knowledge proofs allows for efficient verification, improving the scalability of the BeL2 system.

Importance in the BeL2 Ecosystem

The Cairo Circuit is essential for several reasons:

  • It allows Bitcoin transactions to be efficiently verified on EVM-compatible chains without requiring direct access to the Bitcoin blockchain.

  • By using zero-knowledge proofs, it maintains the privacy of Bitcoin transactions while still allowing for their verification.

  • The compact proofs generated by the Cairo Circuit reduce the computational and storage requirements for verifying Bitcoin transactions on other chains.

Technical Implementation

The Cairo Circuit is implemented using the Cairo programming language, which is specifically designed for creating efficient and verifiable computation. Here's a simplified example of how a Cairo program might structure the proof generation for a Bitcoin transaction:

func verify_bitcoin_transaction(
tx_hash: felt,
merkle_root: felt,
merkle_proof: felt*,
proof_length: felt
) -> (is_valid: felt) {
// Verify the Merkle proof
let (is_valid) = verify_merkle_proof(tx_hash, merkle_root, merkle_proof, proof_length);

// Additional verification steps...

return (is_valid,);
}

func verify_merkle_proof(
leaf: felt,
root: felt,
proof: felt*,
proof_length: felt
) -> (is_valid: felt) {
// Merkle proof verification logic
// ...

return (is_valid,);
}

This example demonstrates a basic structure for verifying a Bitcoin transaction using a Merkle proof. The actual implementation would include more complex verification steps and optimizations.

How It Works with Other Components

The Cairo Circuit is an integral part of the BeL2 architecture and works in conjunction with other components:

  1. zkBTC Full Nodes use the Cairo Circuit to generate zero-knowledge proofs of Bitcoin transactions.
  2. These proofs are then passed to Arbitrator Nodes in the Arbitrator Network for verification and relay to EVM-compatible chains.
  3. The EVM ZKP Contract on the EVM side uses the Cairo Circuit's verification mechanism to validate the proofs.
  4. The Transaction Verifier Contract relies on the Cairo Circuit's proofs to maintain a record of verified Bitcoin transactions.