What is a Smart Wallet?
A Smart Wallet is a wallet that is controlled by a smart contract following the ERC-4337 specification.
Ethereum has 2 types of accounts to transfer and receive tokens: EOAs (Externally Owned Accounts) and Contract Accounts. A smart contract wallet is a wallet managed by a contract account instead of an EOA. A smart wallet is a wallet type requiring no private keys or seed phrases. Smart contract wallets rely on code instead of private keys to secure and recover wallet information.
A smart contract wallet is a type of Web3 wallet powered by smart contracts.
Benefits of Smart Wallets
- Optimized transaction efficiency & batch transactions
- Combine multiple transactions into a single atomic transaction
- Improved Security Features
- Social & Multi-Sig Recovery
- Recover a wallet without seed phrases/passwords
- Nominate a trusted person to recover your wallet in the case of an emergency
- Smart wallets can be programmed to do anything a smart contract can do
- Smart wallets can be upgraded to add new features
Smart Wallet Factories
In order to issue smart wallet account contracts for users, an account factory contract must be deployed. This factory contract is responsible for deploying individual user contracts when required, and comes in two different flavours.
Types of Account and Account Factory
Account Type Feature Comparison
To learn more about each factory and their respective account implementations, read our smart contract deep dive.
This is the default admin on an account or the "key" to an account. It can be any wallet and is used to initialize the account. Any one wallet can only be the "key" to one account per factory contract.
This wallet is the primary way to access and interact with the account.
In the context of smart wallets, the account is the ERC-4337 compatible smart contract which holds all of the assets.
The smart wallet is the combination of your personal wallet "key" plus the account smart contract with all of it's assets.
This is the data structure for the "pseudo-transaction" that the user wants to perform. The transaction is pseudo as Smart Wallets cannot initiate transactions on EVM chains as they are not supported natively. It contains the following fields:
sender: The account making the operation.
nonce: Anti-replay parameter; also used as the salt for first-time account creation.
initCode: The initialization code needed to create the account (needed if and only if the account is not yet onchain).
callData: The data to pass to the
senderduring the operation.
callGasLimit: The amount of gas to allocate for the operation.
verificationGasLimit: The amount of gas to allocate for the verification step.
preVerificationGas: The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata.
maxFeePerGas: Maximum fee per gas (similar to EIP-1559
maxPriorityFeePerGas: Maximum priority fee per gas (similar to EIP-1559).
paymasterAndData: Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction).
signature: Data passed into the account along with the nonce during the verification step. Should depend on the
EntryPointaddress to prevent replay attacks.
The EntryPoint is a singleton contract (a contract that has a predictable address that is the same on every chain).
It has two methods that are used as entry points to execute bundles of UserOperations:
A bundler is a node that monitors the alternative mempool of
UserOperations and bundles multiple
UserOps together to forward to the EntryPoint contract as a single transaction.
UserOps can be sent from different accounts and are bundled and sent to the
EntryPoint contract via a
The bundler is controlled by its own EOA which initially pays for the gas fees upfront and is then repaid by either the sender or a paymaster if the transaction is sponsored.
The entry point contract then uses the
executeOp functions on the smart wallet account contract to verify and execute the
UserOps on behalf of the users.
It allows you to send transactions with smart wallet accounts.
A paymaster is a smart contract that relays transactions. It provides a service that enables a third party to pay
the transaction fee on behalf of the user by funding the paymaster contract in advance. The paymaster acts as a gas reserve which then
can be used during the call execution via the
EntryPoint contract. The thirdweb Smart Wallet paymaster is initially paid for by thirdweb. By using an API key,
the usage is tracked and billed. You can easily define sponsorship rules that determine whether a transaction will be sponsored.