ERC-7769 · Draft · ERC · 2024-08-23
ERC-7769: JSON-RPC API for ERC-4337
Standardizes the JSON-RPC methods wallets use to talk to ERC-4337 bundlers (send, estimate, look up UserOperations), plus debug methods for testing bundlers.
What problem does it solve?
In ERC-4337 account abstraction, users do not send ordinary transactions. They sign UserOperation objects that go to a separate mempool run by bundlers, which pack many of them into one handleOps call on the EntryPoint contract. Standard methods like eth_sendRawTransaction and eth_estimateGas don't fit this flow.
ERC-7769 defines the RPC surface every bundler should expose, so a wallet or SDK can switch bundler providers without code changes.
How it works
eth namespace (public):
| Method | Purpose |
|---|---|
eth_sendUserOperation |
Validate, simulate and add a UserOperation to the mempool; returns userOpHash |
eth_estimateUserOperationGas |
Return preVerificationGas, verificationGasLimit, callGasLimit (and paymaster verification gas); signature may be a stub; accepts a state override set |
eth_getUserOperationByHash |
Return the UserOperation plus blockNumber, transactionHash, etc. |
eth_getUserOperationReceipt |
Return success, actualGasCost, actualGasUsed, this op's own logs, and the bundle's transaction receipt |
eth_supportedEntryPoints |
EntryPoint addresses the bundler accepts, preferred first |
eth_chainId |
EIP-155 chain ID |
Errors use specific codes, for example -32602 invalid fields, -32500 rejected by EntryPoint validation (message carries the AAxx code), -32501 rejected by the paymaster, -32502 ERC-7562 opcode rule violation, -32503 out of time range, -32507 bad signature.
On chains with EIP-7702, a UserOperation may carry an eip7702Auth tuple, and setting factory to the marker 0x7702 tells the EntryPoint the sender is a 7702-delegated EOA; factoryData is then passed to the sender for initialization.
debug namespace (testing only): debug_bundler_clearState, dumpMempool, sendBundleNow, setBundlingMode, setReputation, dumpReputation, addUserOps. These exist so a shared compatibility test suite can drive any bundler.
Sample code
Submitting a UserOperation and polling for its receipt (TypeScript, plain fetch):
async function rpc(method: string, params: unknown[]) {
const res = await fetch(BUNDLER_URL, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
});
const json = await res.json();
if (json.error) throw new Error(`${json.error.code}: ${json.error.message}`);
return json.result;
}
const [entryPoint] = await rpc("eth_supportedEntryPoints", []);
const gas = await rpc("eth_estimateUserOperationGas", [userOp, entryPoint]);
Object.assign(userOp, gas);
userOp.signature = await signUserOp(userOp, entryPoint); // wallet-specific
const userOpHash = await rpc("eth_sendUserOperation", [userOp, entryPoint]);
let receipt = null;
while (!receipt) {
await new Promise((r) => setTimeout(r, 2000));
receipt = await rpc("eth_getUserOperationReceipt", [userOpHash]);
}
console.log(receipt.success, receipt.actualGasCost);
Things to know
- Status: Draft. Field names and error codes may still change.
- All numeric fields are hex strings, and empty bytes must be
"0x". receiptineth_getUserOperationReceiptcovers the whole bundle; use the top-levellogsfor your own operation.postOpGasLimitfor paymasters cannot be estimated reliably; paymasters should supply it.debug_*methods must never be exposed on production endpoints.