Frame-works!

Know before you sign: viem toolkit for the frame-tx alt mempool, plus relayerless privacy-pool exits

Frame-works!

Created At

ETHGlobal Mumbai

Project Description

Altpool is a viem toolkit for the ERC-8421 alternative mempool on the EIP-8141 frame-transaction devnet. Today developers send frame transactions blind: per-frame gas limits are written by hand, keyed nonces are managed by hand, and you only learn why a transaction was rejected afterwards, on the explorer.

Altpool fixes that:

  • SDK (altpool): a viem extension that fills per-frame gas, allocates EIP-8250 nonce keys, stakes your entity, preflights, sends, waits for the receipt and fetches the node's rule-by-rule admission report.
  • Admission simulator (checkAdmission) and the frame-doctor CLI: before you sign, it tells you whether the public mempool and the alt mempool will admit a frame tx, and if not, which rule fails, for which entity, and the fix. Verdicts produced by ethrex or the sidecar are marked verified; the rest come from our local rule model and are labelled unverified.
  • Entity monitor (watchEntity + a live web page): stake, reputation, headroom before throttling, pending txs, inclusions and rejections across the gateway and miner nodes, with webhook alerts.
  • MCP server: AI agents can call check_admission, get_admission_report and entity_status.

QuietSend is the app we built with it. A privacy pool lets you withdraw to a fresh, unlinked wallet, but that wallet holds 0 ETH and can't pay gas. You either fund it from your old wallet, which links the two, or use a relayer that sees your details and can refuse you. QuietSend removes the relayer. One staked contract, ExitRelay, sends the withdrawal from the devnet's existing, unmodified privacy pool as an EIP-8141 frame transaction, and is repaid from the withdrawal's fixed fee in the same transaction. Before paying, its VERIFY frame checks the pool root and the nullifier and verifies the Groth16 proof itself (about 375k gas, fixed and pinned at 450k). The public mempool rejects that on two counts (the 100k validation cap and reading another contract's storage), and Altpool tells you so before you sign. The alt mempool admits it because ExitRelay is staked. Exits are live on the public devnet.

Also built and live on the devnet:

  • Pledge Paid: one 9-frame transaction that pays an invoice straight out of a WETH privacy pool (proof check, unwrap, Uniswap v4 swap, settle, sweep and a books check, all atomic).
  • Wallet Bridge: MetaMask or Rabby control a frame-tx account by signing EIP-712 typed data.
  • Falcon-512 post-quantum recipient wallets for QuietSend exits.

Honest limit: on the devnet, the pool's crowd is accounts we seeded, so this proves the mechanism, not privacy yet.

How it's Made

A bun + Turborepo monorepo: TypeScript packages on viem, Solidity contracts in Foundry, a React 19 + Vite + Tailwind site.

  • Codec: all encoding, hashing and signing use @forshtat/hegota-support, the devnet's own codec (ethrex-eip8141-tracer profile). We didn't write a second one.
  • Simulator: the public-mempool verdict comes from ethrex's own simulate (canonicalMempoolValid / canonicalMempoolViolation), so it's ground truth. The alt mempool has no dry-run RPC, so the alt verdict comes from the sidecar's admission records or the explorer when available, and otherwise from our model of the ERC-7562 / ERC-8421 rules. It routes each tx to public, alt via gateway or miner, or nowhere. Every real rejection we hit is saved as a test fixture.
  • ExitRelay: 3 frames. Frame 0 is the built-in EXPIRY_VERIFIER deadline; frame 1 is ExitRelay's VERIFY (scope EXECUTION_AND_PAYMENT, 450k limit); frame 2 is a SENDER frame calling pool.withdraw with relayer = ExitRelay. VERIFY reads the other frames with the frame opcodes and runs the cheapest checks first: frame shapes, max cost <= fee, withdraw calldata, nonce key == nullifierHash, then pool.roots(idx), isSpent, and the proof last. Using the nullifier as the EIP-8250 nonce key lets many exits wait in parallel, with only one pending exit per note.
  • The hacky part: the devnet's Tornado v2.0 verifier calls the precompiles with staticcall(sub(gas(), 2000), ...), which breaks ERC-7562 OP-012 ("payer uses banned opcode: GAS"), so the gateway rejected our exit. Our deploy script copies the verifier's runtime bytecode and rewrites 3 sites (PUSH2 0x07d0 GAS SUB -> JUMPDEST x4 GAS). Same length, same verifying key, 15 bytes changed; deploy asserts the copy and the original agree on a real proof (true) and on fee + 1 (false). The pool still re-verifies with the original in the SENDER frame.
  • Prover: snarkjs 0.1.20, websnark and a circomlib MiMC Merkle tree, with a key converter for the v2.0 circuit. It also runs in the browser.
  • Pledge Paid: PayRelayWETH (staked) checks the proof against a WETH Tornado pool and pins frames 2-8; a CREATE2 Settler runs unwrap, Uniswap v4 swap, settle, sweep and a books check as one atomic batch; InvoiceBook records the payment. 9/9 frames succeeded on the devnet.
  • Wallet Bridge: no wallet can sign a type-0x06 frame tx, but every wallet signs EIP-712, so BridgeAccount's VERIFY frame recovers that signature with ecrecover.
  • Falcon: FalconWallet verifies a Falcon-512 signature (vendored ZKNOX ETHFALCON verifier, MIT) carried in an ARBITRARY signature entry. VERIFY costs about 3.9M gas, so it only runs on the alt mempool.
  • MCP: a stdio server wrapping the simulator and monitor for AI agents.
  • While building, we wrote up the devnet rule bugs we hit for the devnet team, e.g. the gateway's included count stays at 0, so a busy entity gets throttled after about 110 sends.

AI assistance was used and is disclosed per event rules.

background image mobile

Join the mailing list

Get the latest news and updates

Frame-works! | ETHGlobal