AnonAI

Private keystorage, permission, and gas sponsorship for autonomous AI agents via EIP-8141 altmempool

AnonAI

Created At

ETHGlobal Mumbai

Project Description

Ethereum was built around the larger vision of self-sovereignty - we should retain control over our identities, assets, and actions without depending on centralised 'trusted' intermediaries.

But as autonomous AI agents begin acting on behalf of users, a new question emerges: Can we delegate our ability to act without also giving up our privacy and sovereignty?



Today, an agent acting on Ethereum often acquires a persistent, publicly observable on-chain identity. Its transactions can reveal what it does, which contracts it interacts with, and potentially who operates it. Delegated signing and smart wallets may restrict what an agent can do, but they do not inherently prevent its activities from being traced. Meanwhile, more sophisticated privacy-preserving authorization mechanisms can exceed the validation limits of Ethereum's canonical mempool, pushing developers toward specialized transaction infrastructure.

AnonAI enables autonomous AI agents to transact on Ethereum without exposing individual on-chain identities, while allowing their owners to retain cryptographically enforced control over what they can do.

AnonAI combines privacy-preserving keystorage and authorization using Semaphore zero-knowledge proofs, anonymous execution through a shared smart account, and programmable gas sponsorship through a paymaster. Built on EIP-8141 frame transactions and the public ERC-8421 alternative mempool, it also integrates Anon-RPC to extend privacy to browser-based blockchain reads.

Instead of assigning each agent a publicly identifiable wallet, AnonAI allows multiple agents belonging to different owners to transact through a shared smart account. Each agent proves its authorization anonymously using a Semaphore zero-knowledge proof, while on-chain policies enforce exactly which contracts it can interact with, how much it can spend, and how frequently it can act. Owners can revoke these permissions at any time, without requiring the agent to hold their private keys.

Gas is sponsored through shared policy-class budgets, removing the need to fund individual agent wallets with ETH. Transactions are propagated through a public alternative mempool rather than a proprietary private relay, allowing privacy-preserving authorization to coexist with open, permissionless transaction infrastructure.


For agents, this means the freedom to act autonomously without a conventional Ethereum signing key, an ETH balance, or a unique on-chain identity that links their actions together. For owners, it means delegating authority without surrendering control or unnecessarily exposing their identity and activity.

The current architecture of AnonAI provides anonymous authorization within shared policy groups but that imposes a limitation on accessing privacy for complex and highly customised policies. Our next step is to decouple identity anonymity from policy uniformity, allowing agents with individually programmable permissions to prove compliance in zero knowledge without fragmenting their anonymity sets.

We believe autonomous agents should inherit Ethereum's guarantees of self-sovereignty, not become an exception to them. AnonAI is an open-source effort to make privacy-preserving, permissionless agent execution a native part of Ethereum's emerging account abstraction infrastructure.

How it's Made

AnonAI is built on EIP-8141 frame transactions and the ERC-8421 alternative mempool, with Solidity smart contracts, Semaphore v4 zero-knowledge proofs, TypeScript, viem, an MCP integration for Claude, and Anon-RPC.

The core engineering challenge was to separate an agent's identity, authorization, execution, and gas payment without losing the ability to enforce permissions on-chain.

Three main contracts - Keystore, SharedAccount, and BudgetPaymaster - connected through a four-frame transaction that handles authorization, payment, and execution atomically.

--

1. Keystore: anonymous authorization and revocable permissions

  • On-chain Keystore using Semaphore v4 and Poseidon-based incremental Merkle trees (LeanIMT).

  • Agents are registered under shared policy classes, where each class defines a specific set of permissions: the allowed contract address, function selector, maximum ETH value, and maximum token transfer amount.

  • Each agent has a private Semaphore identity secret, while only its cryptographic commitment is inserted into the Keystore's Merkle tree. Multiple agents belonging to different owners can register under the same policy class.

  • When an agent wants to transact, it generates a Groth16 zero-knowledge membership proof locally. The proof demonstrates that it belongs to an authorized group without revealing which registered member it is.

  • Crucially, the proof is bound to the exact action being requested — including the target contract, calldata, chain ID, shared account, and policy class. This prevents a valid authorization from being reused for an unrelated transaction.

  • Demo currently uses depth-10 Semaphore proofs, supporting up to 1,024 members per policy class.

  • One interesting design decision was how rate limit and replay protection were implemented.

  • Instead of building a separate on-chain nullifier registry, used the Semaphore nullifier directly as an EIP-8250 keyed nonce, with the nonce sequence set to zero.

  • Each committed Keystore root defines an authorization epoch. An agent can act once within that epoch, and the protocol's nonce mechanism prevents the same authorization from being used again.

  • The Keystore also supports revocation. Removing an agent's commitment increments the policy class's generation, invalidating previously committed roots for authorization purposes. Additionally integrated EIP-8272 recent-root references to help the mempool track root freshness.

  • This enables anonymous membership proofs, single-use authorization, rate limiting, and revocation without revealing the agent's identity during execution.

--

2. SharedAccount: executing without individual agent wallets

All agents transact through a common SharedAccount smart contract, which acts as the sender of EIP-8141 frame transactions.

The account's validation logic supports two authorization modes:

  • Zero-knowledge mode: A Semaphore Groth16 proof establishes anonymous membership in a policy class. The transaction uses EIP-8141's arbitrary signature scheme rather than a conventional Ethereum signing key.
  • One-time-key mode: Each agent uses a registered, single-use secp256k1 key. This is computationally cheaper but sacrifices the anonymity provided by Semaphore membership proofs. The agent registers a batch of one-time key addresses as class members. Each key is derived from the agent secret and used once.

In both modes, SharedAccount checks the actual execution frame against the policy: permitted contract, function selector, ETH value, token amount, and the transaction's nonce.

Only after these checks succeed does the account approve execution.

The important distinction is that authorization is enforced by the smart contract rather than by instructions to the AI model. An agent cannot bypass its spending limits simply by deciding to perform a different action.

--

3. BudgetPaymaster: programmable gas sponsorship

  • Stateful paymaster that sponsors gas from budgets assigned to shared policy classes rather than individual agents or owners.

  • This means the agent doesn't need to maintain an ETH balance, and gas payment doesn't require revealing a unique owner-associated wallet in each transaction.

  • The paymaster reserves the maximum transaction cost from the relevant class budget before approving payment.

  • Solved an interesting issue with frame coordination on the devnet: the expected FRAMEPARAM status inspection was not working, and transient storage wasn't persisting between frames.

  • Workaround was to create a persistent charge receipt keyed by TXPARAM(SIG_HASH). The paymaster's payment-verification frame checks that the same transaction has already successfully charged its budget before approving payment.

  • Stateful, policy-based gas sponsorship within the frame transaction model.

--

4. EIP-8141: combining everything in one transaction

The entire AnonAI execution flow fits into a single four-frame transaction:

  • Frame 0 — Authorization (VERIFY): SharedAccount verifies the Semaphore proof or one-time signature, checks the Keystore and the requested action against its permissions, and approves execution.

  • Frame 1 — Gas reservation (pre_verify): BudgetPaymaster checks the policy-class gas budget, reserves the maximum transaction cost, and records a charge receipt.

  • Frame 2 — Payment approval (VERIFY): BudgetPaymaster verifies the charge receipt and approves gas payment.

  • Frame 3 — Execution (SENDER): The authorized transaction executes from the shared account, such as transferring WETH to a recipient.

This is where EIP-8141 becomes particularly useful: authorization, gas sponsorship, and execution can be programmed independently while remaining part of one atomic transaction.

The agent never needs to sign a conventional Ethereum transaction from its own wallet or fund an individual address with ETH.

--

5. ERC-8421: why the alternative mempool is essential

Zero-knowledge authorization consumes approximately 296,823 validation gas, well above the canonical EIP-8141 mempool's 100,000-gas validation limit.

The SharedAccount also needs to read external Keystore and verifier state, while BudgetPaymaster needs to read and update shared budget storage during validation. These patterns are restricted under canonical mempool rules.

Integrated with the public ERC-8421 workshop alternative mempool, running through its gateway and miner sidecars and the ethrex execution client.

The alternative mempool supports more expressive validation under staking, reputation, and resource-accounting rules designed to protect nodes against denial-of-service attacks.

Deployed and staked both SharedAccount and BudgetPaymaster, and built the TypeScript transaction builder around the workshop's @forshtat/hegota-support package.

Transactions are submitted using eth_sendFrameTransaction, simulated by the sidecar, evaluated against its admission rules, and propagated for block inclusion.

A direct comparison with the canonical mempool is implemented: the same ZK-authorized frame transaction is rejected by the canonical mempool but admitted and mined through the alternative mempool.

This is a central demonstrations. ERC-8421 isn't simply an alternative transaction submission endpoint for AnonAI — it enables the computationally expensive cryptographic authorization and stateful paymaster logic that the canonical mempool cannot accommodate.

--

6. Anon-RPC: extending privacy to blockchain reads

  • Anonymous authorization alone doesn't eliminate every source of privacy leakage. RPC providers can still observe which addresses, balances, contracts, and transactions a user is querying.

  • Integrated @anon-rpc/browser-harness into frontend to add a separate privacy layer for blockchain reads.

  • The browser harness uses an isolated, null-origin iframe and Web Worker, with support for Tor, Nym, and passthrough transports. When enabled and ready, dashboard RPC requests are routed through this environment instead of being sent directly from the user's ordinary browser connection.

  • This complements Semaphore's on-chain anonymity by addressing network-level observability during blockchain reads.

  • The current integration covers the browser dashboard; the Node-based MCP server and runner still use direct RPC connections. The browser also falls back to direct requests if the privacy transport is unavailable.

--

7. MCP integration: giving Claude autonomous execution capabilities

  • Local Model Context Protocol server using the TypeScript MCP SDK, allowing Claude to interact with AnonAI directly.

  • The server exposes tools for inspecting the agent's permissions, reading blockchain state, performing authorized WETH transfers, checking transaction status, and comparing canonical versus alternative mempool behavior.

  • When Claude requests a transaction, the local runtime retrieves the agent's authorization credential, constructs the required proof, assembles the four-frame transaction, submits it to the alternative mempool, and returns the on-chain result.

  • The private Semaphore credential stays with the local runtime rather than being passed to the AI model.

  • This provides a working demonstration of an autonomous agent performing blockchain actions under cryptographically enforced permissions without holding a conventional Ethereum signing key or ETH for gas.

--

8. Dashboard, testing, and engineering challenges

React/Vite dashboard with a local HTTP and Server-Sent Events runner to visualize the full transaction lifecycle: agent request, authorization, frame construction, mempool admission, mining, and execution.

The dashboard also exposes the distinction between public and private information, compares ZK authorization with one-time-key authorization, and demonstrates permission revocation and canonical mempool rejection.

The development process involved several protocol-specific challenges:

  • Real ZK verification: integrated Semaphore's Groth16 verifier into the SharedAccount's validation frame rather than simulating authorization.
  • Protocol-native replay protection: mapped Semaphore nullifiers to EIP-8250 keyed nonces, avoiding separate spent-nullifier storage.
  • Cross-frame payment coordination: implemented transaction-bound charge receipts to work around missing frame-status functionality in the development client.
  • Mempool propagation: After observing unreliable gossip between gateway and miner sidecars following restarts, we added direct submission of identical transaction bytes to both public sidecars.
  • Gas and validation constraints: measured approximately 296,823 gas for ZK verification, 53,591 for one-time-key authorization, 42,127 for gas reservation, and 27,437 for payment approval.

Foundry + Solidity development and testing, including tests that generate actual Semaphore proofs through FFI. The repository includes 31 Solidity tests, deployed contract artifacts, setup scripts, CLI tools, an MCP server, and the interactive frontend.

The implementation is running on the public ERC-8421 workshop devnet (chain ID 1337), where both authorization modes have been demonstrated end-to-end.

--

Ultimately, AnonAI demonstrates how Ethereum's emerging native account abstraction and alternative mempool infrastructure can support anonymous authorization, programmable keystorage, revocable agent permissions, and gas-sponsored execution without depending on a proprietary private relay.

background image mobile

Join the mailing list

Get the latest news and updates

AnonAI | ETHGlobal