While most online articles about ERC-4337 offer introductory explanations, hands-on implementation guides are scarce. This article bridges that gap by providing actionable steps for deploying and interacting with Account Abstraction (AA) smart contracts.
Prerequisites
Contract Deployment
- EntryPoint Contract: Use the latest EntryPoint address from Infinitism’s Discord.
VerifyingPaymaster:
Deploy using multisol:
cd account-abstraction multisol contracts/samples/VerifyingPaymaster.sol- Connect Remix to the generated
multisol-verifyingpaymasterdirectory viaremixd. - Deploy with MetaMask, passing the EntryPoint address and
verifyingSigneraccount.
Other Contracts:
- SimpleAccountFactory: Deploys AA instances.
- TestToken: ERC-20 contract for minting tokens.
Contract Verification
Upload all .sol files from the multisol-verifyingpaymaster directory via Etherscan’s "Solidity (Multi-Part files)" option.
Staking and ETH Deposit
- Call
addStakeanddepositTofor the paymaster via Etherscan, referencing sample transactions.
Key Addresses
- EntryPoint:
0x0F46c65C17AA6b4102046935F33301f0510B163A - VerifyingPaymaster:
0xE0165B20422B0dC3802085D34013bA0E2a83f640
Bundler Setup
Use a local stackup-bundler for logging:
- Ensure the bundler’s account holds sufficient ETH for gas fees.
- Nodes must support
debug_traceCall(e.g., Goerli RPC).
Commands
Run using config.json:
ETH Transfer
yarn run simpleAccount transfer --to 0x413978328AA912d3fc63929d356d353F6e854Ee1 --amount 0.001ERC-20 Transfer
yarn run simpleAccount erc20Transfer --token 0x61a89342F52d9F31626B56b64A83579E5c368f4c --to 0x413978328AA912d3fc63929d356d353F6e854Ee1 --amount 0.1Paymaster Integration
Append --withPaymaster:
yarn run simpleAccount erc20Transfer --token 0x61a89342F52d9F31626B56b64A83579E5c368f4c --to 0x413978328AA912d3fc63929d356d353F6e854Ee1 --amount 0.1 --withPaymasterTransaction Analysis
- ETH Transfer: Bundler submits
handleOpsto EntryPoint, which routes funds and reimburses gas.
👉 View ETH Transfer - ERC-20 Transfer: Similar flow, but for token transfers.
- Paymaster ERC-20 Transfer: Gas fees deducted from paymaster’s ETH balance.
Gasless Chains Recommendation
For gasless transactions, leverage Godwoken’s built-in AA support, eliminating the need for a bundler.
FAQs
Q: Why is debug_traceCall required for bundlers?
A: It validates UserOperation simulations, ensuring only viable transactions are bundled.
Q: Can I use Infura/Alchemy as a bundler node?
A: No—they lack debug_traceCall support. Use Goerli RPC or a local geth full node.
Q: How does paymaster sponsorship work?
A: The paymaster’s ETH balance in EntryPoint covers gas fees, verified via verifyingSigner signatures.
👉 Explore Paymaster Options