ERC-7679 · Draft · ERC · 2024-04-05
ERC-7679: UserOperation Builder
Lets each ERC-4337 smart account publish an on-chain 'builder' contract that encodes its own nonce, calldata and signature, so any wallet or dapp can build UserOperations without an account-specific SDK.
What problem does it solve?
ERC-4337 lets smart accounts send UserOperations (UserOps), but it leaves three fields up to each account implementation: the nonce, the callData and the signature. One account might expose executeFoo, another executeBar; one packs a validator address into the nonce, another wraps the signature with extra data.
The result is that a dapp or wallet that wants to send a UserOp has to know which account implementation it is talking to and ship that vendor's SDK. That is vendor lock-in, and it fragments the account-abstraction ecosystem.
ERC-7679 moves that account-specific encoding logic on-chain, behind one common interface.
How it works
Each smart account implementation provides a UserOp builder contract implementing IUserOperationBuilder:
| Function | Returns |
|---|---|
entryPoint() |
The ERC-4337 EntryPoint the account supports |
getNonce(account, context) |
The nonce to use |
getCallData(account, executions, context) |
callData for a batch of (target, value, callData) executions |
formatSignature(account, userOp, context) |
The raw signature wrapped in the account's expected format |
context is an opaque byte string the account owner (or their wallet) hands to the building party. It carries whatever the builder needs, for example a delegation authorization.
The suggested flow for a building party:
- Get the builder address and
contextfrom the account owner. eth_callgetNonceandgetCallData(ideally batched).- Fill a UserOp with low gas values, sign it, and call
formatSignatureto get a correctly shaped dummy signature for gas estimation. - Estimate gas, put the real gas values in, sign again, and call
formatSignatureonce more to get the final, valid UserOp.
Other UserOp fields (gas, paymaster, etc.) are out of scope. For accounts not yet deployed, the spec describes a CounterfactualCall contract, inspired by ERC-6492, that deploys the account inside an eth_call via the factory and then queries the builder.
Sample code
Building callData and nonce with ethers v6:
import { Contract, JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const builder = new Contract(builderAddress, [
"function entryPoint() view returns (address)",
"function getNonce(address smartAccount, bytes context) view returns (uint256)",
"function getCallData(address smartAccount, (address target, uint256 value, bytes callData)[] executions, bytes context) view returns (bytes)",
], provider);
const executions = [
{ target: tokenAddress, value: 0n, callData: transferData },
];
const [nonce, callData] = await Promise.all([
builder.getNonce(account, context),
builder.getCallData(account, executions, context),
]);
// Fill the rest of the UserOp, then call formatSignature(...) for the dummy and final signatures.
Things to know
- Status: Draft. The interface may still change.
- The interface targets EntryPoint v0.7 (
PackedUserOperation). Accounts on EntryPoint v0.6 need a variant using the v0.6 struct. - Dummy signatures matter: they must consume roughly as much gas as a real one, which is why they come from the account-specific builder rather than a fixed value.
- The dummy signature is exposed publicly; the spec recommends signing the dummy UserOp with very low gas values so it is useless if intercepted.
- It complements modular-account standards such as ERC-7579, which standardize execution and modules inside the account rather than how UserOps are built from outside.