Simple 7702 Account (EntryPoint v0.9)
The Simple7702AccountV09 is a minimalist smart contract account for EIP-7702, targeting EntryPoint v0.9 (0x433709009B8330FDa32311DF1C2AFA402eD8D009). It shares the same audited contract implementation and API surface as Simple7702Account, with type specialization for UserOperationV9.
EntryPoint v0.9 maintains ABI compatibility with v0.8 while adding:
- Parallelizable Paymaster Signing: New
paymasterSignaturefield allows passing data to Paymasters after UserOperation signing. - Block Number-Based Validity Ranges:
validAfterandvalidUntilcan now specify block numbers instead of timestamps. - Flexible InitCode Handling:
initCodeis silently ignored if the Account already exists, enabling two-dimensional nonce usage. - UserOp Hash Query: New
getCurrentUserOpHashfunction exposes the current UserOperation hash during execution.
The following ERCs are supported:
- ERC-165
- ERC-721
- ERC-1155
- ERC-1271
- ERC-4337 v0.9
A complete working example is available on GitHub: 01-upgrade-eoa.ts
Smart Contracts and Audits
The contracts were developed by the Ethereum Foundation Account Abstraction Team and audited by Cantina.
How to Use
Prerequisites
Before using Simple7702AccountV09, you must have:
- Node.js: Version 18.0 or higher.
- EIP-7702 Compatible Network: Ethereum mainnet, Sepolia, or other EIP-7702 enabled chains with EP v0.9 support.
- Private Key Access: Required for signing authorizations and user operations.
Installation
npm install abstractionkit
Usage
import { Simple7702AccountV09 } from "abstractionkit";
const delegatorPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31"; // EOA public key
const smartAccount = new Simple7702AccountV09(delegatorPublicAddress);
Constructor defaults:
entrypointAddress:0x433709009B8330FDa32311DF1C2AFA402eD8D009(EntryPoint v0.9)delegateeAddress:0xa46cc63eBF4Bd77888AA327837d20b23A63a56B5
Both can be overridden by passing an overrides object as the second constructor argument.
Essential Methods
createUserOperation
Creates a UserOperation for EIP-7702 accounts that can be sent to bundlers for execution.
- example.ts
- Param Types
- Return Type
import { Simple7702AccountV09 } from "abstractionkit";
const delegatorPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const smartAccount = new Simple7702AccountV09(delegatorPublicAddress);
const transactions = [
{
to: "0x...",
value: 0n,
data: "0x...",
},
];
const userOperation = await smartAccount.createUserOperation(
transactions,
"https://ethereum-sepolia-rpc.publicnode.com", // provider RPC
"https://your-ep-v09-bundler-rpc", // bundler RPC (must support EP v0.9)
{
eip7702Auth: {
chainId, // chainId at which the account will be authorized
},
// Optional overrides
maxFeePerGas: 20000000000n,
maxPriorityFeePerGas: 2000000000n,
}
);
| key | type | description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
transactions | SimpleMetaTransaction[] | Array of transactions to include in the user operation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
providerRpc? | string | Optional JSON-RPC provider URL for blockchain queries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bundlerRpc? | string | Optional bundler RPC URL for gas estimation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
overrides? | | Optional overrides for user operation creation |
SimpleMetaTransaction
| key | type | description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SimpleMetaTransaction | | SimpleMetaTransaction is the type of transaction used with Simple7702Account. |
| key | type | description | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userOperation | | The constructed user operation for EIP-7702 |
signUserOperation
Signs a UserOperation with the provided private key for the EIP-7702 account.
- example.ts
- Param Types
- Return Type
const signature = smartAccount.signUserOperation(
userOperation,
"0x...private-key",
11155111n // chain ID
);
userOperation.signature = signature;
| key | type | description | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userOperation | | The user operation to sign | |||||||||||||||||||||||||||||||||||||||||||||||||||
privateKey | string | Private key to sign the user operation with | |||||||||||||||||||||||||||||||||||||||||||||||||||
chainId | bigint | Chain ID for the target blockchain |
| key | type | description |
|---|---|---|
signature | string | The signature for the user operation |
signUserOperationWithSigner
Signs a UserOperation using an ExternalSigner instead of a raw private key. Integrates viem, ethers, browser wallets, hardware wallets, HSMs, and MPC services through the same API.
Since AbstractionKit v0.3.5, Simple7702AccountV09 accepts signers that implement either signTypedData or signHash. The SDK prefers signTypedData when available, so JSON-RPC wallets and viem WalletClient instances can sign EntryPoint v0.9 UserOperations without raw-hash signing support. Raw-hash signers continue to work.
import { fromViemWalletClient } from "abstractionkit";
import { createWalletClient, custom } from "viem";
import { sepolia } from "viem/chains";
const chain = sepolia;
const walletClient = createWalletClient({
account: delegatorPublicAddress,
chain,
transport: custom(window.ethereum),
});
userOperation.signature = await smartAccount.signUserOperationWithSigner(
userOperation,
fromViemWalletClient(walletClient),
11155111n, // chain ID
);
See External Signers for the full list of adapters and custom-signer integrations. EntryPoint v0.9 also supports parallel paymaster signing via the two-phase signingPhase context — see the parallel signing example.
getUserOperationEip712Data
Builds the EIP-712 typed data payload for a UserOperation under the EntryPoint v0.9 domain. Use this static helper when you need to inspect the wallet prompt payload or drive a custom signTypedData primitive directly.
import { Simple7702AccountV09 } from "abstractionkit";
const typedData = Simple7702AccountV09.getUserOperationEip712Data(
userOperation,
11155111n,
);
const signature = await walletClient.signTypedData(typedData);
userOperation.signature = signature;
getUserOperationEip712TypedData was renamed in v0.3.8 and moved from an instance method to a static helper. Use getUserOperationEip712Hash(userOperation, chainId, overrides?) when you only need the digest.
sendUserOperation
Sends a signed UserOperation to the bundler for execution on-chain.
- example.ts
- Param Types
- Return Type
const response = await smartAccount.sendUserOperation(
userOperation,
"https://your-ep-v09-bundler-rpc" // bundler URL (must support EP v0.9)
);
console.log("UserOperation hash:", response.userOperationHash);
// Wait for the transaction to be included
const receipt = await response.included();
console.log("Transaction receipt:", receipt);
| key | type | description | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userOperation | | The signed user operation to send | |||||||||||||||||||||||||||||||||||||||||||||||||||
bundlerRpc | string | Bundler RPC URL to send the user operation to |
| key | type | description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
response | | Response containing user operation hash and bundler details |
SendUseroperationResponse
| key | type | description |
|---|---|---|
userOperationHash | string | The hash over the userOp (except signature), entryPoint and chainId |
bundler | Bundler | The Bundler class |
entrypointAddress | string | The entrypoint address where the useroperation got executed |
included() | Promise<UserOperationReceiptResult | BundlerJsonRpcError> | Waits for the user operation to be included onchain and returns the user operation receipt on success, or the bundler error on failture |
BundlerJsonRpcError
| key | type | description |
|---|---|---|
code | number | Bundler RPC error code |
message | string | Bundler RPC error message description |
UserOperationReceiptResult
| key | type | description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userOpHash | string | The hash of the user operation. | |||||||||||||||||||||||||||||||||
entryPoint | string | The address of the entry point contract that processed the operation. | |||||||||||||||||||||||||||||||||
sender | string | The address of the sender of the user operation. | |||||||||||||||||||||||||||||||||
nonce | bigint | The nonce of the user operation. | |||||||||||||||||||||||||||||||||
paymaster | string | The address of the paymaster that paid for the gas of the user operation. | |||||||||||||||||||||||||||||||||
actualGasCost | bigint | The actual gas cost incurred for executing the user operation. | |||||||||||||||||||||||||||||||||
actualGasUsed | bigint | The actual amount of gas used for the user operation. | |||||||||||||||||||||||||||||||||
success | boolean | Indicates whether the user operation was successful. | |||||||||||||||||||||||||||||||||
logs | string | The logs produced during the execution of the user operation. | |||||||||||||||||||||||||||||||||
receipt | | The detailed receipt of the user operation. |
prependTokenPaymasterApproveToCallDataStatic
Prepends a token approval transaction to existing call data for use with token paymasters.
- example.ts
- Param Types
- Return Type
const callDataWithApproval = Simple7702AccountV09.prependTokenPaymasterApproveToCallDataStatic(
"0x...", // existing call data
"0xa0b86a33e6b3e96bb24b8e4b28e80e0fb3a4f4b6", // USDC token address
"0x...", // paymaster address
1000000n // approve amount (1 USDC)
);
| key | type | description |
|---|---|---|
callData | string | Existing call data to prepend the approval to |
tokenAddress | string | Address of the ERC-20 token to approve |
paymasterAddress | string | Address of the paymaster contract |
approveAmount | bigint | Amount of tokens to approve for the paymaster |
| key | type | description |
|---|---|---|
callData | string | Call data with token approval prepended |
prependTokenPaymasterApproveToCallData
Instance method to prepend token approval to call data for paymaster usage.
- example.ts
- Param Types
- Return Type
const callDataWithApproval = smartAccount.prependTokenPaymasterApproveToCallData(
"0x...", // existing call data
"0xa0b86a33e6b3e96bb24b8e4b28e80e0fb3a4f4b6", // USDC token address
"0x...", // paymaster address
1000000n // approve amount
);
| key | type | description |
|---|---|---|
callData | string | Existing call data to prepend the approval to |
tokenAddress | string | Address of the ERC-20 token to approve |
paymasterAddress | string | Address of the paymaster contract |
approveAmount | bigint | Amount of tokens to approve for the paymaster |
| key | type | description |
|---|---|---|
callData | string | Call data with token approval prepended |
Advanced Methods
createAccountCallData
Creates call data for a basic transaction with specified target, value, and data.
- example.ts
- Param Types
- Return Type
const callData = Simple7702AccountV09.createAccountCallData(
"0x...", // to address
1000000000000000000n, // value in wei
"0x..." // transaction data
);
| key | type | description |
|---|---|---|
to | string | Target address for the transaction |
value | bigint | Value to transfer in the transaction |
data | string | Call data for the transaction |
| key | type | description |
|---|---|---|
callData | string | Encoded call data for the account transaction |
createAccountCallDataSingleTransaction
Creates call data for a single SimpleMetaTransaction.
- example.ts
- Param Types
- Return Type
const metaTransaction = {
to: "0x...",
value: 0n,
data: "0x...",
};
const callData = Simple7702AccountV09.createAccountCallDataSingleTransaction(metaTransaction);
| key | type | description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metaTransaction | | The SimpleMetaTransaction to create call data for |
| key | type | description |
|---|---|---|
callData | string | Encoded call data for the account transaction |
createAccountCallDataBatchTransactions
Creates call data for batching multiple SimpleMetaTransactions together.
- example.ts
- Param Types
- Return Type
const transactions = [
{ to: "0x...", value: 0n, data: "0x..." },
{ to: "0x...", value: 0n, data: "0x..." },
];
const callData = Simple7702AccountV09.createAccountCallDataBatchTransactions(transactions);
| key | type | description |
|---|---|---|
transactions | SimpleMetaTransaction[] | Array of SimpleMetaTransactions to batch together |
| key | type | description |
|---|---|---|
callData | string | Encoded call data for the account transaction |
estimateUserOperationGas
Estimates gas limits for a UserOperation using the bundler.
- example.ts
- Param Types
- Return Type
const [preVerificationGas, verificationGasLimit, callGasLimit] =
await smartAccount.estimateUserOperationGas(
userOperation,
"https://your-ep-v09-bundler-rpc",
{
// Optional overrides
stateOverrideSet: {...},
dummySignature: "0x...",
}
);
| key | type | description | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userOperation | | The user operation to estimate gas for | |||||||||||||||||||||||||||||||||||||||||||||||||||
bundlerRpc | string | Bundler RPC URL for gas estimation | |||||||||||||||||||||||||||||||||||||||||||||||||||
overrides? | | Optional overrides for gas estimation |
| key | type | description |
|---|---|---|
gasLimits | [bigint, bigint, bigint] | Tuple of [preVerificationGas, verificationGasLimit, callGasLimit] |
Delegation Methods
isDelegatedToThisAccount
Checks if the EOA is currently delegated to the expected smart account address via EIP-7702. Returns true only when delegated to the account's delegateeAddress.
- example.ts
- Param Types
- Return Type
const isDelegated = await smartAccount.isDelegatedToThisAccount(
"https://ethereum-sepolia-rpc.publicnode.com"
);
if (isDelegated) {
console.log("EOA is delegated to this smart account");
} else {
console.log("EOA is not delegated");
}
| key | type | description |
|---|---|---|
providerRpc | string | Ethereum JSON-RPC node URL |
| key | type | description |
|---|---|---|
isDelegated | boolean | true if the EOA is delegated to the expected address, false otherwise |
createRevokeDelegationTransaction
Creates a signed EIP-7702 transaction that revokes the delegation, restoring the EOA to a regular account. The transaction delegates to address(0), removing the smart account code from the EOA.
This is a regular Ethereum transaction (type 0x04), not a UserOperation. The EOA needs native tokens to pay for gas.
Revocation cannot be done via a UserOperation because the authorization list is processed before execution, which would remove the account's code mid-transaction.
- example.ts
- Param Types
- Return Type
const signedTransaction = await smartAccount.createRevokeDelegationTransaction(
"0x...private-key",
"https://ethereum-sepolia-rpc.publicnode.com",
);
// Send using your preferred method (e.g., viem, ethers)
// const txHash = await client.request({
// method: 'eth_sendRawTransaction',
// params: [signedTransaction],
// });
| key | type | description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eoaPrivateKey | string | The EOA's private key (signs both the authorization and the transaction) | |||||||||||||||||||||
providerRpc | string | JSON-RPC endpoint for nonce, gas price, and chain ID queries | |||||||||||||||||||||
overrides? | | Optional overrides for transaction fields |
| key | type | description |
|---|---|---|
signedTransaction | string | Signed raw transaction hex, ready for eth_sendRawTransaction |
Error Handling & Common Issues
- Authorization Errors
- Gas Estimation Issues
- Network Mismatches
// Missing eip7702Auth on the first UserOperation authorization
const userOperation = await smartAccount.createUserOperation(
transactions,
providerRpc,
bundlerRpc,
{
eip7702Auth: { chainId: 11155111n }, // Required for EIP-7702
}
);
// Use multipliers if gas prices are volatile
const userOperation = await smartAccount.createUserOperation(
transactions,
providerRpc,
bundlerRpc,
{
eip7702Auth: { chainId: 11155111n },
maxFeePerGasPercentageMultiplier: 120, // 20% above current network conditions
maxPriorityFeePerGasPercentageMultiplier: 150, // 50% above current network conditions
}
);
// Ensure chainId, RPC, and bundler all target the same network
const userOperation = await smartAccount.createUserOperation(
transactions,
"https://ethereum-sepolia-rpc.publicnode.com", // Sepolia RPC
"https://your-ep-v09-bundler-rpc", // Sepolia EP v0.9 bundler
{
eip7702Auth: { chainId: 11155111n }, // Sepolia chainId
}
);