Skip to main content
An account is an unique entity that can send transactions, users usually use wallets to manage their accounts. Historically, in Ethereum, all accounts were Externally Owned Accounts (EOA) and were controlled by private keys. This is a simple and secure way to manage accounts, but it has limitations as the account logic is hardcoded in the protocol. Account Abstraction (AA) is the concept behind abstracting parts of the account logic to allow for a more flexible account system. This replaces EOA with Account Contracts, which are smart contracts that implement the account logic. This opens up a lot of possibilities that can significantly improve the user experience when dealing with accounts. On Starknet, Account Abstraction is natively supported, and all accounts are Account Contracts.

Account Contract

A smart contract must follow the Standard Account Interface specification defined in the SNIP-6. In practice, this means that the contract must implement the SRC6 and SRC5 interfaces to be considered an account contract.

SNIP-6: SRC6 + SRC5

The Call struct is used to represent a call to a function (selector) in a target contract (to) with parameters (calldata). It is available under the starknet::account module.
A transaction can be represented as a list of calls Array<Call> to other contracts, with atleast one call.
  • __execute__: Executes a transaction after the validation phase. Returns an array of the serialized return of value (Span<felt252>) of each call.
  • __validate__: Validates a transaction by verifying some predefined rules, such as the signature of the transaction. Returns the VALID short string (as a felt252) if the transaction is valid.
  • is_valid_signature: Verify that a given signature is valid. This is mainly used by applications for authentication purposes.
Both __execute__ and __validate__ functions are exclusively called by the Starknet protocol.
The interface identifiers of both SRC5 and SRC6 must be published with supports_interface.

Minimal account contract Executing Transactions

In this example, we will implement a minimal account contract that can validate and execute transactions.