GardenBlockchain

Testing ERC-4337 in a local environment

A small account-abstraction experiment: a local chain, a bundler, a mock paymaster, and a Safe smart account.

A local account-abstraction setup makes it easier to see the pieces separately: the chain accepts transactions, the bundler handles user operations, and the paymaster participates in the demonstration’s sponsorship flow. This note follows a small Safe smart-account experiment from the original setup.

Historical experiment. The recorded run uses EntryPoint 0.7. The commands and output below are retained from the original example; the chain and client have not been rerun for this revision. A mock paymaster is development infrastructure.

The local pieces

The environment repository documents an Anvil chain, an Alto bundler, and a mock paymaster. Its README lists these local endpoints:

Component Local endpoint Role in the experiment
Anvil localhost:8545 Development chain
Alto localhost:4337 Bundler
Mock paymaster localhost:3000 Development paymaster

Start with that repository’s setup instructions. Keep the chain configuration, deployed EntryPoint, and client settings aligned; the environment contains deployments for more than one EntryPoint version.

Set up the client

Once the local environment is available, the original client setup is:

git clone https://github.com/nhancv/script-erc4337-aa-pimlico-example.git
cd script-erc4337-aa-pimlico-example
yarn install

The client repository uses its master branch. At editorial review, its manifest declared permissionless ^0.2.47 and viem ^2.30.1. Those are declared ranges, not proof of the exact versions installed for the earlier run. Reproducing it requires checking the repository’s own lockfile and configuration.

Run the example

yarn start

The recorded flow creates or identifies a Safe smart account, funds it on the development chain, and sends 0.001 ETH from that account to the example destination. The balances and transaction hash below belong to that recorded run.

Read the recorded output

Entry point: 0x0000000071727De22E5E9d8BAf0edAc6f37da032 (0.7)
Smart Account type: SafeSmartAccount
EOA Wallet: 0xd41C952747A2a7043aAa4a251636cF778AFC5D07
Smart Account (SA): 0x0ffA0256EA13Be360BfE69F9ce09841a6438aB7d
EOA balance: 0
 SA balance: 0
Funding 0.001 ETH for SA 0x0ffA0256EA13Be360BfE69F9ce09841a6438aB7d, balance is now 0.001
Sending ETH from SA to 0x000000000000000000000000000000000000dead with amount 0.001
Tx hash: 0x2511574a9190ea4945eaef99dfbe7466b6984675dc338209dbb1d8a7b5f25353
SA 0x0ffA0256EA13Be360BfE69F9ce09841a6438aB7d balance now is 0
TO 0x000000000000000000000000000000000000dead balance now is 0.001
DONE

The useful checkpoints are the EntryPoint version, smart-account type, account addresses, and balance changes. If a later run differs, inspect those first rather than assuming that the account, bundler, and paymaster are using the same settings.

The final DONE line describes completion of this particular example. It does not establish that a different account configuration or a production sponsorship policy works.

Continue exploring

← Back to the garden