TL;DR
- A contract on Base checks every Zcash block header against Zcash’s consensus rules: the Equihash (200, 9) solution on the EIP-152 BLAKE2b precompile, the difficulty adjustment (including NU7’s 25-second blocks), the time rules and cumulative work. Contracts can then read Zcash’s best chain without trusting a bridge, a committee or whoever relays. Anyone can feed it; a feeder can delay the relay but cannot make it accept a header Zcash’s rules reject.
- One header costs about 626k gas (mean, whole transaction); Equihash is 361k of it. Following Zcash at 25-second blocks is ~3,456 headers, ≈ 2.2 × 10⁹ gas a day: about 0.01 ETH a day at Base’s 0.005 gwei.
- A relay deployed with Mainnet parameters on 29 October 2026 crossed Zcash Mainnet’s NU7 activation (height 3,543,405, 6 November 2026) without a redeploy and followed the 5,405 headers after it.
- On top of the relay: a RISC Zero proof (Groth16-wrapped, 256,720 gas to verify on Base) that a shielded payment of at least an amount went to a receiver an app committed to, with a memo naming the app’s reference, inside the ZIP 221 chain history of a header the relay holds. The transaction id, the note, the block and the address never reach the EVM chain. A real Testnet payment was proven in 81 s on a rented RTX 4090, for about one cent.
- Testnets only, unaudited. Code (MIT), the real-header test corpus and the source of every number: GitHub - Himess/seam: A Zcash light client for EVM chains: Base checks Zcash headers itself (Equihash, difficulty, most work), and ZK proofs of shielded payments against them. · GitHub
1. Why
Using ZEC in an EVM application today means trusting someone who attests to what happened on Zcash: a bridge committee, a multisig or a custodian. The alternative is old. BTC Relay put an SPV client for Bitcoin on Ethereum in 2016, so contracts could trust proof of work instead of people. For Zcash this was blocked by Equihash: verifying one solution takes 512 BLAKE2b hashes, prohibitive in plain Solidity. That was the stated motivation of EIP-152, the BLAKE2b compression precompile added in Istanbul (2019): a BTC Relay-style Zcash SPV client on Ethereum.
Two things make it practical now. An L2 makes per-header verification cheap enough to follow every block (§4). And a zkVM makes it possible to prove facts about a block’s contents without revealing them. That matters more for Zcash than for any other chain: a Merkle proof of a shielded payment’s txid, submitted from an EVM account, links the two and undoes the privacy the payer paid for.
2. The relay
2.1 What every header must pass
The rules follow Zebra (v7.0.0-rc.0) and the ZIPs; each one cites its source in the code.
- Format and linkage. 1,487 bytes (a 140-byte prefix, compactSize(1344), the solution), version ≥ 4, a known parent, not already known.
- Time. Later than the median of the previous 11 blocks; at most 90 minutes after that median; at most 2 hours ahead of Base’s
block.timestamp(Zebra’s local-clock rule, with the L2’s clock standing in for the node’s). - Difficulty.
nBitsmust equal what the adjustment requires: the mean target over the averaging window, damping factor 4, bounds of +16 % / −32 %, medians of 11 timestamps, capped at the PoW limit. The window is 17 blocks at 75 s before NU7 and 102 blocks at 25 s from NU7 (ZIP 218, ZIP 259), switched at a height fixed at deployment. Testnet’s minimum-difficulty rule (a block more than 450 s after its parent must carry0x2007ffff) is a parameter, refused with the Mainnet network id. - Equihash (200, 9), following librustzcash’s verifier: BLAKE2b-400 with the
ZcashPoWpersonalization, 512 21-bit indices, collisions on 20 bits at each of 9 levels, ordering, distinct indices, a zero root. The first 128-byte BLAKE2b block is compressed once; each index then costs one final-block compression on the precompile (0x09). - Proof of work. SHA-256d of the header, read little-endian, at most the target.
- Fork choice. A block becomes the tip only with strictly more cumulative work, where \text{work} = 2^{256} / (\text{target} + 1); ties keep the first block seen. Reorganisations of any depth are followed (Zebra itself refuses to reorganise below 1,000 blocks).
Not checked: block contents. hashMerkleRoot and hashBlockCommitments are stored as the proof of work commits to them; facts about what a block contains need an inclusion proof (§5).
2.2 Feeding, reorganisations, and what a feeder can do
submitHeaders is permissionless and skips headers the relay already has, so racing feeders waste gas but break nothing. The reference feeder fetches headers over Zcash’s P2P protocol, follows reorganisations with a block locator of the relay’s best chain, and submits batches. Four to eight headers per batch is cheapest: 597k gas per header at 4, 645k at 16, where memory costs grow.
One review finding shaped the storage design. Clearing the best-chain index of every orphaned height costs gas per height, so an attacker could build a long, light branch on a stale tip and push the honest reorganisation over the transaction gas limit, freezing the relay. The relay now rewrites only the new branch’s entries and leaves heights above the new tip as stale entries that every view ignores (all reads are bounded by the tip height). The cost of a reorganisation no longer depends on the orphaned branch.
A feeder can withhold headers (a delay) but cannot forge them. An application whose users wait on the relay (a deadline, a pending settlement) should run or at least watch a feeder of its own.
2.3 What you trust
- Zcash’s proof of work, to the depth you require (§3).
- The deployment input: the checkpoint (a hash and height, plus the times and
nBitsof the 113 blocks ending with it) and the network parameters. The constructor refuses inconsistent parameters, not wrong ones, so both must be compared with a node or an explorer. - Someone feeding it (liveness only).
- Base’s clock, for the 2-hour rule. The OP Stack keeps an L2 timestamp within 30 minutes of its L1 origin, so a skewed clock can delay a header or admit one slightly early, never one without the work.
3. Finality: require work, never a block count
Zcash Testnet’s minimum-difficulty rule lets anyone mine a block at difficulty 1 when its timestamp is more than 450 s after its parent’s. Such a block adds 32 units of work; a normal post-NU7 Testnet block adds about 380,000. Miners choose timestamps (within the 2-hour bound), and once the averaging window holds easy blocks the following ones stay easy too: in a simulation, 300 extra confirmations cost 0.085 of one honest block’s work. So the relay exposes confirmationWork(h), the cumulative work on top of h on the best chain, and documents confirmations(h) as a convenience, never a security measure.
On Mainnet the measure is the same; the numbers differ. Read from the relay: the 100 blocks up to 3,535,181 (before NU7) added about 2.59 × 10¹² work per block; the 100 blocks up to 3,548,810 (after NU7) about 8.1 × 10¹¹ per block, in 2,683 s. A single Equihash ASIC outpaces all of Testnet’s miners, so a Testnet relay secures nothing. On Mainnet an application must require enough work that renting the hashrate to mine it in private, from a fork point below the anchor, costs more than everything its open obligations hold together.
4. Measurements
Gas, with forge test --isolate (every submission its own transaction, cold storage), solc 0.8.28, 200 optimizer runs:
| gas | |
|---|---|
submitHeader, whole transaction, Testnet after NU7 (102-block window), 32 real headers |
min 613,810 · mean 625,703 · max 664,744 |
| the same, Mainnet before NU7 (17-block window) | mean 579,490 |
| execution of one typical header | 576,543 |
| ↳ Equihash: 512 index decodes and 513 BLAKE2b compressions (274,120), tree check (82,843) | 361,100 |
| ↳ time rules and difficulty: mean target over 102 blocks (56,766, mostly 13 cold reads), two medians (≈ 15,400) | ≈ 76,500 |
| ↳ storage (a 4-slot record, the best-chain index, the tip) and events | ≈ 134,000 |
| deployment, with the 113 context entries and 12 parameters | 3,253,717 |
Feeding Seam’s relays on Base Sepolia (receipts of 29 October 2026, gas price 0.005 to 0.006 gwei; the L1 data fee was under 0.01 % of each fee):
| headers | gas per header | ETH per header | |
|---|---|---|---|
| Testnet, catching up, batches of 8 | 557 in 70 txs | 604,805 | 0.00000341 |
| Testnet, following the tip | 15 in 4 txs | 600,388 | 0.00000335 |
| Mainnet before NU7, catching up | 315 in 40 txs | 578,105 | 0.00000321 |
At 25-second blocks that is 3,456 headers and ≈ 0.012 ETH a day; priced on a Base mainnet fork at a 0.005 gwei base fee, ≈ 0.010 ETH a day.
Validation against real data. A Python port of the rules reproduces nBits and passes the time rules for all 23,400 Testnet headers from 4,464,800 to 4,488,199 (225 before NU7, 23,174 after); every one also passes Equihash and PoW. Changing the window to 17, the spacing to 75 s, the activation height by one block, the damping, its rounding, or the order of division and multiplication each breaks real blocks. On Mainnet, 1,600 consecutive headers (3,497,446 .. 3,499,045), linked by SHA-256d to hashes in Zebra’s checkpoint list, pass with Mainnet parameters, and the 12,706 headers from Zebra’s last checkpoint up to the relay’s checkpoint were checked before deployment. The Solidity Equihash verifier agrees with the equihash crate Zebra calls on 592 labelled cases. The 80 relay tests run on real headers; synthetic headers appear only in tests, with genuine Equihash solutions found at Testnet’s minimum difficulty.
NU7 on Mainnet. The Mainnet relay was deployed on 29 October from checkpoint 3,534,866, with NU7 at 3,543,405 (ZIP 259). It accepted the activation block (header time 2026-11-06 02:34 UTC; nBits went from 0x1b675f5f to 0x1c009054 as the window and the spacing switched) and the 5,405 headers after it, with no redeploy.
5. Proving a shielded payment against the relay
5.1 The statement
A RISC Zero guest accepts a private witness only if:
- Epoch. The transaction’s consensus branch id is one the build allows. The network is a build parameter, so each network has its own guest and image id.
- Shape. A v6 transaction that touches only the Ironwood pool (NU6.3): no transparent part, no Sapling, no Orchard-pool action.
- Inclusion. The txid reaches block B’s
hashMerkleRoot. B’s ZIP 221 history leaf, through its path and the peaks, together with the auth data root of a later header T, reaches T’shashBlockCommitments(ZIP 244). T is the anchor and must be a header the relay holds. - The note. The witness’s opening (receiver, value, rseed) rebuilds the note, and the action’s ciphertext decrypts to exactly that note, so the receiver’s wallet finds it and can spend it.
- The memo starts with
seam1:and 64 hex digits: the app’spaymentRef. - The receiver matches
receiverCommitment = keccak256(salt32 ‖ receiver43).
The guest commits a 192-byte journal: (version, branchId, anchor, paymentRef, receiverCommitment, zatoshi). The verifier on Base checks the Groth16 seal through RISC Zero’s router for a pinned image id and selector, checks that the anchor is on the relay’s best chain, and returns the payment and the work on top of the anchor. It is stateless: the application binds each paymentRef to one obligation and settles it once.
5.2 What reaches the EVM chain
| On chain | Never on chain |
|---|---|
| the anchor T, a header the relay holds | the transaction id |
paymentRef, chosen by the app |
the payment’s block B, one of the blocks between the order and T |
receiverCommitment |
the note commitment and the nullifier |
| the value and the branch id | the receiver, its address and viewing key, the salt |
The value is public; an application whose amounts must stay private needs a different statement. The salt must be fresh and secret for each payment: a reused salt links payments, and a guessable one lets anyone test candidate receivers against the commitment.
5.3 Cost of one real payment (0.01 TAZ on Zcash Testnet, 30 October 2026)
| Step | Measured |
|---|---|
| guest execution | 19,918,817 cycles in 21 segments, 0.9 s |
| STARK receipt, RTX 4090 | 43.1 s |
| Groth16 wrap, same machine | 34.2 s; a 260-byte seal |
verify on a Base Sepolia fork, with the Groth16 check |
256,720 gas |
| machine cost of the proof (rented at $0.52 an hour) | ≈ $0.01 |
A CPU is not an option yet: a proof of the same size ran for 7 h 58 min on a 4-core server. A live verifier on Base Sepolia (0x1701…d5f9) returns this payment’s journal to anyone who calls it.
5.4 What you trust, and the bound that matters
RISC Zero’s proof system and its Groth16 setup; the governance of RISC Zero’s verifier router (it can stop a verifier but not swap the one behind a selector: a liveness risk, not a safety risk); the pinned image id, which anyone can rebuild in RISC Zero’s Docker builder; pre-release Zcash crates and a patched pasta_curves compiled only for the zkVM.
The bound that matters is economic. The statement checks inclusion and the note, not Zcash’s Halo 2 proofs or signatures: those were Zcash consensus’s job when the block was mined into the chain the relay follows. A chain an attacker mines in private can carry any transaction, so the work an application requires on top of an anchor must outweigh the value of all its open payments together. One deep enough reorganisation could fake a payment for each of them.
5.5 Privacy beyond the chain
The anchor reveals a header, so the payment is known to sit in some block after the order and before T. To keep that set large: fix the anchor height first, pay after a random delay, and keep payment and anchor in one epoch (the ZIP 221 tree restarts at every network upgrade). Building the witness asks a light wallet server for the transaction by its id, so that server learns what is being proven unless the prover runs its own or reaches one over Tor. The CLI refuses to hand a witness to a remote prover.
6. Limitations
- Testnets only; unaudited.
- The checkpoint and the network parameters are trusted deployment input.
- Liveness depends on someone feeding the relay.
- One real Testnet payment has been proven so far. The Mainnet guest is pinned but has proven no real Mainnet payment.
- Today only the receiver (with its viewing key), or a payer who paid with the
seamCLI, can prove: most wallets don’t export a note’s opening, and recovery with the payer’s outgoing viewing key is not implemented yet. - Proving needs a GPU.
7. Related work
BTC Relay (2016) established on-chain SPV relays on Ethereum. EIP-152’s motivation was a Zcash relay of the same kind, and Consensys’ Project Alchemy implemented BLAKE2b and Equihash in Solidity towards it. “Bridging Sapling: Private Cross-Chain Transfers” (arXiv:2204.10611) studies private transfers between Zcash and other chains. ZIP 221 commits to chain history for FlyClient-style light clients, and “Catching the Fly” (arXiv:2604.26736) discusses what it takes to make FlyClient practical.
8. Open questions
- Skipping headers. ZIP 221’s history tree was designed for FlyClient. Could a relay accept a sampled proof over many headers instead of every header, and which sampling and work parameters are safe when an L2 contract is the verifier?
- Per-header checks or zkVM batches. At ~2.2 × 10⁹ gas a day, where is the break-even with proving batches of headers off-chain and verifying one proof?
- Sizing the required work. Equihash hashrate can be rented. Is there a principled way to set the work an application requires against its total open obligations, and should the relay or the application enforce it?
- Standards. Is a common reader interface for PoW-chain relays on EVM chains worth an ERC? Should the payment memo format and statement become a ZIP?
Feedback is very welcome, especially on the consensus checks, the reorganisation handling and the economic bound in §5.4.
Links
- Repository and README: GitHub - Himess/seam: A Zcash light client for EVM chains: Base checks Zcash headers itself (Equihash, difficulty, most work), and ZK proofs of shielded payments against them. · GitHub
- Relay design, every rule’s source and the gas table:
contracts/src/relay/README.md - Payment proofs:
docs/PAYMENTS.md; integrating:docs/INTEGRATING.md; feeding:docs/RELAYING.md - Relays on Base Sepolia: Testnet
0x77ce…cE0c, Mainnet0x527B…BE48
Disclosure: I designed Seam and built it with AI coding assistants. Every number above links to a test, a file or a transaction in the repository.