Skip to content

Add EIP: Counterfactual Transaction#11518

Open
benaadams wants to merge 13 commits intoethereum:masterfrom
benaadams:counterfactual-transaction
Open

Add EIP: Counterfactual Transaction#11518
benaadams wants to merge 13 commits intoethereum:masterfrom
benaadams:counterfactual-transaction

Conversation

@benaadams
Copy link
Copy Markdown
Contributor

@benaadams benaadams commented Apr 12, 2026

Summary

EIP-8224 introduces a new EIP-2718 transaction type (0x08) - the counterfactual transaction - for protocol-native shielded gas funding using ZK proofs against canonical fee-note contracts.

The problem

A fresh EOA with no ETH can't pay gas. Receiving ETH from any source creates a traceable on-chain link - defeating the privacy goal. This is the bootstrapping problem that remains even after EIP-8223 (Contract Payer Transaction / sponsored transactions).

How it works

  1. A user deposits ETH into a canonical fee-note contract instance (recognized by runtime code hash, not a fixed address), receiving a private Poseidon commitment
  2. Later, from a fresh EOA, they submit a counterfactual transaction carrying an fflonk ZK proof (over BN254) that they own an unspent fee note sufficient to cover gas
  3. The protocol verifies the proof (no EVM execution needed - bounded cryptographic computation + fixed storage reads), consumes the fee note's nullifier, settles gas, and sends any leftover ETH to a designated gas_refund_recipient
  4. The transaction body executes normally - it can call any contract (privacy pool withdrawal, account setup, etc.)

Key design properties

  • Code-hash recognition - fee-note contracts are recognized by EXTCODEHASH, not a fixed predeploy address. Multiple instances can coexist. The transaction names its instance via fee_note_contract, and the proof binds to that address
  • fflonk over BN254 - universal setup (reuses existing powers-of-tau), 2-pair pairing verification, ~176K gas proof verification cost. No circuit-specific trusted setup ceremony
  • Append-only accepted roots - deposits add roots that are never revoked. Proofs against older roots remain valid forever, preventing censorship-based griefing
  • Arbitrary note values - no fixed denomination tiers. Deposit any ETH amount; the circuit proves fee_denomination == note_value
  • chain_id bound in proof - defense-in-depth against cross-chain replay (8 public inputs total)
  • Explicit intrinsic gas - proof verification, state access/mutation, and settlement transfer logs are itemized following EIP-2780 methodology with EIP-7904 precompile costs
  • One-shot bootstrap - used once to fund a smart account and register it in the Contract Payer Transaction payer registry; all subsequent txs use cheap sponsored transactions
  • Composable - the data field can target any contract; the fee note only handles gas authorization
  • Bounded ETH exit - unused fee-note value emerges as public ETH at gas_refund_recipient, doubling as an account bootstrap mechanism
  • Mempool-safe - validation is bounded cryptographic computation + a canonical code-hash check + fixed storage reads, no EVM execution

Intrinsic gas breakdown

Component Gas
Base (EIP-2780) 4,500
fflonk proof verification (9 ECMUL + 9 ECADD + 2-pair ECPAIRING) 176,346
Fee-note state access 6,800
Fee-note state mutation 22,500
ETH transfer logs 3,512
Fixed subtotal 213,658
Proof calldata (~512 bytes) ~8,192
Typical minimum total ~222,000

Dependencies

EIP-196, EIP-197, EIP-1559, EIP-2718, EIP-2780, EIP-3529, EIP-4788, EIP-6780, EIP-7708, EIP-7904

Status

Draft - canonical fee-note bytecode, verification key, circuit artifacts, and cross-client test vectors are not yet published.

@benaadams benaadams requested a review from eth-bot as a code owner April 12, 2026 01:37
Copilot AI review requested due to automatic review settings April 12, 2026 01:37
@github-actions github-actions Bot added c-new Creates a brand new proposal s-draft This EIP is a Draft t-core labels Apr 12, 2026
@eth-bot
Copy link
Copy Markdown
Collaborator

eth-bot commented Apr 12, 2026

File EIPS/eip-8224.md

Requires 1 more reviewers from @g11tech, @jochem-brouwer, @lightclient, @samwilsn

@eth-bot eth-bot added e-consensus Waiting on editor consensus e-review Waiting on editor to review labels Apr 12, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Core Standards Track EIP draft (EIP-8224) specifying a typed transaction (0x08) that pays for gas via a ZK proof against a canonical ETH “fee note” pool, including mempool rules, validation/execution semantics, and a fee-note predeploy interface.

Changes:

  • Introduces the EIP-8224 draft spec for counterfactual transactions (type 0x08).
  • Specifies a canonical fee-note predeploy at 0x14, storage layout, and protocol read/write semantics.
  • Defines Groth16/BN254 proof statement, public inputs, and validation/execution rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread EIPS/eip-8224.md Outdated
Comment thread EIPS/eip-8224.md Outdated
Comment thread EIPS/eip-8224.md Outdated
Comment thread EIPS/eip-8224.md Outdated
@github-actions github-actions Bot added w-ci Waiting on CI to pass and removed w-ci Waiting on CI to pass labels Apr 12, 2026
@github-actions
Copy link
Copy Markdown

The commit 5626193 (as a parent of 344f83c) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions Bot added w-ci Waiting on CI to pass and removed w-ci Waiting on CI to pass labels Apr 12, 2026
Copy link
Copy Markdown

@Eazy1231 Eazy1231 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

benaadams:counterfactual-transaction

@SamWilsn SamWilsn force-pushed the counterfactual-transaction branch from 4ff1aa1 to 7f91aad Compare April 24, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-new Creates a brand new proposal e-consensus Waiting on editor consensus e-review Waiting on editor to review s-draft This EIP is a Draft t-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants