How different projects sell EIP-4337 to their customers?
Couple of days ago a college of mine told me he had a gig about implementing AA, so started my investigation about it. He had a client, a small business that sells a product, and they wanted to implement AA to make the purchase (of the NFT of its product) process easier. First I've done a very small implementation which is here in my github based on Patrick Collins courses, to have a hands on experience on it... but then I got curious about how different chains implement the idea, so this blog is about that....
to check out what AA ( Account Abstraction ) is: https://www.erc4337.io/
What is AA in simple terms:
according to this Vitalik's post :
Instead of modifying the logic of the consensus layer itself, we replicate the functionality of the transaction mempool in a higher-level system. Users send UserOperation objects that package up the user’s intent along with signatures and other data for verification. Either miners or bundlers using services such as Flashbots can package up a set of UserOperation objects into a single “bundle transaction”, which then gets included into an Ethereum block.
a detailed explanation of the architecture is here and this is the diagram:
And this are the main actors:
-
UserOperations
are pseudo-transaction objects that are used to execute transactions with contract accounts. These are created by the dapp. Wallets should be able to translate regular transactions into UserOperations so dapps' frontends don't need to change anything to support ERC-4337 -
Bundlers
are actors that package UserOperations from a mempool and send them to the EntryPoint contract on the blockchain. For more detailed documentation on bundlers head on to this part(opens in a new tab) of the documentation. -
EntryPoint
is a smart contract that handles the verification and execution logic for transactions. Account Contracts are smart contract accounts owned by a user. -
Account Contract
is the smart contract wallet of a user. Wallet developers are required to implement at least two custom functions - one to verify signatures, and another to process transactions. -
Factory Contract
- When using a wallet for the first time, the initCode field of the UserOperation is used to specify creation of the smart contract wallet. This is used concurrently with the first actual operation of the wallet (in the same UserOperation). Therefore, wallet developers also need to implement the account factory contract (for example: BLSAccountFactory.sol(opens in a new tab)). Creating new wallets should use the CREATE2 method to ensure the determinacy of generated addresses. -
Paymaster Contracts
are optional smart contract accounts that can sponsor gas fees for Account Contracts, or allow their owners to pay for those fees with ERC-20 tokens instead of ETH. For more detailed documentation on paymasters head on to this part(opens in a new tab) of the documentation.
Ok... that works perfect on eth chain, it is complex and involves a lot of moving parts but I can get it.... but what happens with the EntriPoint contract? that is a contract so it will be the same for each chain? I know contract addreses can be forced to be the same on different chains usin CREATE2 but it is that the way is being thought?...
also should I deploy a bundler of my own? there are already services like Alchemy or something that simplify this? let's see...
How Web3Auth solves this:
Web3Auth is a service that simplifies the process of connecting wallets to your dApp, here is a guide about gasless transactions
of course is a third party service that involves apiKeys so you need to trust them but also be willing to be charged in the future.
How Safe solves this:
safe.global has adopted a modular and flexible approach to integrating the ERC-4337, allowing users to turn their Safe account into an ERC-4337 smart account. Docs here
this to me sounds like a good solution because is available in various chains and safe is been in the space for a long time now... only thing is that you need to use the latest version of their contracts but that is ok for a new project....
and they have this disclaimer "EntryPoint compatibility: The Relay Kit only supports the ERC-4337 EntryPoint v0.6. v0.7 is not supported yet"
Smart wallet from Coinbase:
Smart Wallet enables users to create an account in seconds with no app or extension required leveraging Passkeyes ( the ones you generate on your devices, iCLoud, Google Password Manager, etc...)
It supports
- Multiple owners
- Passkey owners and Ethereum address owners
- Cross-chain replayability for owner updates and other actions: sign once, update everywhere.
you can read their github repo here
thanks to the Base Gassless Campaign developers can keep building and delivering stuff and Base will pay for the gas (you have to do some propaganda, posting things in tw an things like that but is good!)
lastly for the sponsored transactions they had a step by step of how to integrate it here and you need to have some stuff configured in their developers dashboard Coinbase Developer Platform and thats it.