Skip to main content

Account Abstraction (ERC-4337 / ERC-7579)

ERC-4337 introduces account abstraction without protocol changes. Users interact through smart contract wallets. Transactions are replaced by UserOperations processed by a Bundler and verified by an EntryPoint contract.

Architecture

User signs UserOperation
|
v
Bundler (JSON-RPC)
|
v
EntryPoint.handleOps()
|
+--> Wallet.validateUserOp()
| |
| +--> (optional) Paymaster.validatePaymasterUserOp()
|
+--> Wallet.execute(callData)

UserOperation Fields

FieldDescription
SenderThe smart contract wallet address
NonceAnti-replay nonce managed by the EntryPoint
InitCodeFactory call to deploy the wallet (empty if already deployed)
CallDataThe actual operation to execute
CallGasLimitGas for the main execution
VerificationGasLimitGas for the verification step
PreVerificationGasGas overhead for bundler compensation
MaxFeePerGasEIP-1559 max fee
MaxPriorityFeePerGasEIP-1559 priority fee
PaymasterAndDataOptional paymaster for sponsored gas
SignatureSignature for wallet verification

Building a UserOperation

using Nethereum.AccountAbstraction;

var userOp = new UserOperation
{
Sender = "0xYourSmartWalletAddress",
Nonce = 0,
CallData = callData.ToHex(),
CallGasLimit = 100000,
VerificationGasLimit = 150000,
PreVerificationGas = 21000,
MaxFeePerGas = Web3.Convert.ToWei(30, UnitConversion.EthUnit.Gwei),
MaxPriorityFeePerGas = Web3.Convert.ToWei(1, UnitConversion.EthUnit.Gwei)
};

Paymasters

Paymasters sponsor gas fees for UserOperations, enabling gasless transactions:

  • Verifying Paymaster — validates an off-chain signature
  • ERC-20 Paymaster — accepts tokens as gas payment
  • Sponsoring Paymaster — fully sponsors gas

Nethereum Bundler

Nethereum includes its own bundler for development and application-specific chains:

dotnet add package Nethereum.AccountAbstraction.Bundler

Packages

PackageDescription
Nethereum.AccountAbstractionUserOperation creation, encoding, gas estimation
Nethereum.AccountAbstraction.BundlerFull bundler with mempool and reputation
Nethereum.AccountAbstraction.Bundler.RpcServerBundler JSON-RPC server
Nethereum.AccountAbstraction.SimpleAccountSimpleAccount factory interaction
Nethereum.AccountAbstraction.AppChainAA integration for AppChain