A minimal implementation demonstrating ERC-4337 smart accounts using Kernel, Permissionless, and Pimlico's Alto bundler.
This repository demonstrates:
- Smart Account implementation using Kernel
- Integration with ERC-4337 and ERC-7579
- Bundler implementation using Pimlico's Alto
packages/
├── contracts/ # Smart contracts and deployment scripts
└── bundler/ # Local bundler implementation
- Node.js >= 16
- Foundry
- Local Ethereum node (Anvil)
- Clone the repository:
git clone https://github.com/yourusername/smart-account-demo
cd smart-account-demo
- Install dependencies:
cd packages/contracts
make setup
- Run the demo:
make aa-demo-auto
This will:
- Start a local Anvil node
- Deploy the necessary contracts
- Start the bundler
- Execute a demo transaction using the smart account
Run the gas analysis to compare standard transactions vs UserOperations:
make gas-bundler-auto
Copy the example environment file and configure:
cp packages/contracts/.env.example packages/contracts/.env
RPC_LOCAL
: Local node URLBUNDLER_PORT
: Port for the local bundlerPRIVATE_KEY_LOCAL
: Test account private key
This demo showcases a specific behavior with the Alto bundler regarding consecutive UserOperations. The demo attempts to send two UserOps with consecutive nonces simultaneously.
-
Set up a Foundry account for testing following the instructions in
packages/contracts/README.md
. You'll need to:- Import your account using
cast wallet import
- Set up the password file
- Configure the account name in the environment
- Import your account using
-
Install dependencies and setup the environment:
cd packages/contracts
make setup
Run the consecutive nonce demo:
make nonce-demo-auto
This will:
- Start a local Anvil node
- Deploy the necessary contracts
- Start the bundler
- Execute the consecutive UserOps demo
The demo script (packages/contracts/scripts/consecutive_userops_demo.ts
) should demonstrate the following sequence:
- First UserOp with nonce 'n' gets bundled and executed on-chain
- Second UserOp with nonce 'n+1' gets picked from the internal mempool
- Second UserOp gets bundled and executed on-chain
Currently, while the first UserOp executes successfully, the second UserOp appears to time out with no response from the bundler. This behavior differs from the expected sequence and is the subject of investigation.