ZK-SNARKs Implementation
IBVM uses ZK-SNARKs to generate cryptographic proofs that state transitions are valid without revealing the full transaction data.
Circuit Design
The ZK circuit in IBVM verifies the correctness of state transitions with the following components:
Transaction Verification Circuit: Validates transaction signatures and nonce values
EVM Execution Circuit: Verifies that each instruction executed correctly
State Transition Circuit: Confirms the validity of state changes
Transaction Verification
For each transaction $T$, the circuit verifies:
Signature validity: $Verify(pk_T, sig_T, hash(T)) = true$
Nonce correctness: $T.nonce = Account[T.from].nonce$
Balance sufficiency: $Account[T.from].balance \geq T.value + T.gasLimit \times T.gasPrice$
EVM Execution
The EVM execution circuit validates each step of transaction execution:
For each instruction $I$ and state $S$:
$S_{i+1} = Apply(S_i, I_i)$
The circuit proves that each $Apply$ function correctly follows EVM rules
State Transition
The state transition circuit verifies:
Initial state hash matches previous state root: $Hash(S_0) = H_s$
Final state hash matches claimed new state root: $Hash(S_n) = H_{s'}$
Each intermediate state is derived correctly: $S_{i+1} = Apply(S_i, I_i)$
Proving System
IBVM uses the Groth16 proving system for efficiently generating and verifying ZK-SNARKs:
Setup Phase:
Generate proving key $pk$ and verification key $vk$
The setup requires a trusted setup ceremony to eliminate backdoors
Proving Phase:
For batch of transactions $B$ with initial state $S_0$ and final state $S_n$
Generate proof $\pi = Prove(pk, S_0, S_n, B)$
Verification Phase:
Verify proof: $Verify(vk, H_s, H_{s'}, \pi) = true$
Recursive Proofs
To handle high throughput, IBVM implements recursive SNARK composition:
Generate sub-proofs $\pi_1, \pi_2, ..., \pi_k$ for smaller batches
Create a recursive proof $\pi_{rec}$ that verifies all sub-proofs are valid
Submit only $\pi_{rec}$ to the Bitcoin blockchain
The recursive verification equation: $Verify_{rec}(vk_{rec}, H_s, H_{s'}, \pi_{rec}) = \bigwedge_{i=1}^{k} Verify(vk, H_{s_{i-1}}, H_{s_i}, \pi_i)$
Last updated