A hands-on implementation of Account Abstraction (ERC-4337) using smart contract wallets, EntryPoint mechanics, and off-chain scripting.
This project explores how UserOperations are constructed, signed, and executed, replacing traditional EOAs with programmable smart accounts.
This repository covers the full Account Abstraction lifecycle:
- Smart Contract Wallet deployment
- ERC-4337 EntryPoint interaction
- UserOperation construction & execution
- Off-chain scripting using TypeScript
- Cross-chain compatibility (Ethereum + zkSync Era)
The focus is on the execution flow and scripting layer, which is critical in real-world AA systems.
- Removes dependency on EOAs
- Introduces UserOperation instead of traditional transactions
- Uses EntryPoint contract for execution
- Enables gas abstraction and programmable accounts
- Construct UserOperation (off-chain)
- Sign with Smart Account owner
- Submit to EntryPoint
- EntryPoint validates:
- Signature
- Nonce
- Gas limits
- Smart Wallet executes transaction
flowchart LR
U[User]
S[TypeScript Scripts]
OP[UserOperation]
EP[EntryPoint]
SW[Smart Wallet]
EX[Execution]
U --> S
S --> OP
OP --> EP
EP --> SW
SW --> EX
- Scripts (off-chain) → build & sign UserOperations
- EntryPoint → validates and routes execution
- Smart Wallet → executes logic on-chain
- Replace EOAs with programmable accounts
- Execute transactions via EntryPoint
- Compatible with Ethereum & zkSync Era
-
Handles:
- Validation
- Execution
-
Central coordination layer for UserOperations
Main focus of the project.
Scripts handle:
- Constructing UserOperations
- Encoding calldata
- Signing operations
- Sending operations to EntryPoint
- Simulating bundler behavior
⚠️ Most complexity in Account Abstraction lives off-chain — this layer is critical.
Deploying ZkMinimal.sol using TypeScript scripts due to:
- Limitations with Foundry scripting on zkSync Era
- Custom deployment scripts (TypeScript)
- Encryption script for private key handling
- Sending AA transaction flow (
sendUserOp) - zkSync-specific execution understanding
yarn installforge buildforge script script/Deploy.s.sol \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--broadcastyarn deploy
# or
npx ts-node typescript-scripts/deploy.tsnpx ts-node typescript-scripts/createUserOp.tsnpx ts-node typescript-scripts/sendUserOp.tsnpx ts-node typescript-scripts/EncryptKey.ts- Ethereum (ERC-4337)
- zkSync Era
- Solidity
- ERC-4337
- Foundry
- TypeScript / JavaScript
- ethers.js / viem
- zkSync SDK
/contracts
├── SmartWallet.sol
├── ZkMinimal.sol
└── (future) Paymaster.sol
/script
├── Deploy.s.sol
├── Interactions.s.sol
/typescript-scripts
├── deploy.ts
├── createUserOp.ts
├── sendUserOp.ts
├── EncryptKey.ts
/test
├── SmartWallet.t.sol
/lib
└── EntryPoint- ERC-4337 architecture
- Full UserOperation lifecycle
- EntryPoint validation and execution
- Importance of off-chain infrastructure
- zkSync vs Ethereum differences
- Smart wallet design patterns
- Paymaster (gas sponsorship)
- Session Keys (delegated permissions)
- Bundler simulation improvements
- zkSync deployment pipeline
- Optional frontend
To build a solid engineering understanding of:
- Smart contract wallets
- Gas abstraction
- Modular account systems
- Off-chain + on-chain interaction
This project is part of a deeper exploration into:
- Account Abstraction
- Smart Wallet Infrastructure
- zkSync ecosystem
Ongoing improvements will focus on scripting, deployment, and architecture.
That’s what makes it hit *professional level*.