After a block is finalized on a Sub-Chain, the Sub-Chain submits a cryptographic proof (hash + optional ZK proof) to the Main Chain. The Main Chain stores only the proof — never raw event data. This is how global immutability is enforced without storing sensitive domain data on the root chain.
This is a post-block trigger, not a user-initiated call. It fires automatically when chain_length % proof_interval == 0.
Flow Diagram
sequenceDiagram
autonumber
participant SC as 📦 SubChain
participant ZKP as 🔐 ZKProver
participant MC as 🔗 MainChain
SC->>SC: auto_submit_proof_if_needed()
SC->>SC: Check: chain length > 1 AND block finalized
alt ZK Proofs Enabled (HRC_ENABLE_ZK_PROOFS=true)
SC->>ZKP: generate_proof(old_state_root, new_state_root, block_index, events)
ZKP->>ZKP: Compute proof (Mock SHA-256 or ZoKrates circuit)
ZKP-->>SC: ProofResult { proof: bytes, success: bool }
SC->>SC: Retry up to 3× with exponential backoff on failure
else ZK Proofs Disabled
SC->>SC: zk_proof = None
end
SC->>SC: _generate_default_proof_metadata()
SC->>MC: add_proof(sub_chain_name, proof_hash, metadata, zk_proof)
MC->>MC: Verify ZK proof (if enabled)
MC->>MC: Store proof block on Main Chain
MC-->>SC: True (success)
SC->>SC: Record proof_submitted event
SC->>SC: Update last_proof_submission timestamp
Step-by-Step Breakdown
Step
Description
1. Trigger check
auto_submit_proof_if_needed() checks len(chain) > 1 and block has been finalized
2. ZK generation
If HRC_ENABLE_ZK_PROOFS=true: ZKProver computes over (old_state_root, new_state_root, events). Retries 3× with backoff