Smart Accounts From Scratch
In this series, we aim to demystify smart accounts by building and deploying one from scratch!
Just want to get building?
This series "Smart Accounts From Scratch" is intended to help you learn ERC 4337 by working directly with the relevant smart contracts and calldata objects. For your production applications using account abstraction, we recommend you use the Account Kit, which has everything you need to provide audited, production-ready smart contract accounts for your users. If you're looking to become more effective with account abstraction by learning it deeply, you're in the right spot! 👨🎓
New to ERC4337?
If you're completely new to ERC 4337 and would like a conceptual overview of how this system works altogether, check out this series of short YouTube videos. These videos will be a good precursor to this series.
The Goal Of This Series
Ok, let's get started! This should be a challenging (and, fun! 😀) set of exercises that allow you to dive deeply into ERC 4337. During these exercises you will be creating several things from scratch:
- Smart Account: a smart contract which acts as a user's account
- Paymaster: a smart contract which pays gas on behalf of a smart account
- User Operation: a meta transaction to execute calls from a smart account
By the end, you will have deployed your own smart account to arbitrum sepolia, made changes with a user operation you built from scratch, and have its gas sponsored by your own paymaster contract! By doing this exercise you'll study and work deeply with the EntryPoint. The EntryPoint is a standard smart contract deployed to EVM chains to provide ERC 4337 account abstraction. It is a neutral smart contract and, once it is deployed, anyone can interact with it. We'll be using the EntryPoint and interfaces from this account-abstraction repository for our exercises.
One last thing to mention before we begin! We'll leave the implementation completely up to you. This means you build it however you like, so long as you accomplish the goal of each step. So, for example, you can use Hardhat or Foundry. We'll be providing general instructions so its up to you to use these tools as you see fit. We'll assume you already know how to deploy and interact with contracts with these tools. To keep things simple in the first few steps, we can deploy these contracts to a local blockchain, but keep in mind, that the final step we'll be deploying to a testnet! It will be helpful to remind yourself this as you're writing your code early on.
Steps
Follow these steps in order to complete the series and become an ERC 4337 expert!
Updated 11 months ago