Learn how smart contract wallets are built following the IAccount standard on Abstract.
tx.from
address for
each transaction that it processes.
Abstract maintains compatibility with popular EOA wallets from the Ethereum ecosystem (e.g. MetaMask) by
converting them to the DefaultAccount system contract during the transaction flow.
This contract acts as you would expect an EOA to act, with the added benefit of supporting paymasters.
IAccount
interface defines the mandatory functions that a smart contract account must implement to be
compatible with Abstract. View source code ↗.
First, install the system contracts library:
IAccount
interface in your smart contract:
magic = ACCOUNT_VALIDATION_SUCCESS_MAGIC
if the transaction is valid and should be executed.onlyBootloader
modifier).ACCOUNT_VALIDATION_SUCCESS_MAGIC
value. Consider:
isSystemCall
flag set to true.onlyBootloader
modifier).onlyBootloader
modifier).
For convenience, there is a _transaction.payToTheBootloader()
function that can be used
to pay the bootloader for the gas fee.
payForTransaction
, if the transaction has a paymaster set,
you can use prepareForPaymaster
to ask the paymaster to sponsor the gas fee for the transaction.
It should only be called by the bootloader contract (e.g. using an onlyBootloader
modifier).
For convenience, there is a _transaction.processPaymasterInput()
function that can be used to prepare the
transaction for the paymaster.
createAccount
and create2Account
.
Differentiate deploying an account contract from deploying a regular contract by providing either of these function names
when initializing a contract factory.
View example zksync-ethers script
from
field as the address of the deployed smart contract wallet.customData
object containing a customSignature
that is not an empty string.View example zksync-ethers script
DefaultAccount
contract is a system contract that mimics the behavior of an EOA.
The bytecode of the contract is set by default for all addresses for which no other bytecodes are deployed.