Tokens are digital assets that represent ownership of anything from dollars to
fund shares. On Solana they’re called SPL (Solana Program Library) tokens.
Every balance change goes through the Token Program, which updates the mint and its token accounts.
Every mint and token account is a
data account owned by a
token program.
Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code.
A token is identified by the address of its
mint account,
which stores:
Supply: Total supply of the token
Decimals: Decimal precision of the token
Mint authority: The account authorized to create new units of the token,
increasing the supply
Freeze authority: The account authorized to freeze tokens in a Token
Account, preventing them from being transferred or burned
The mint authority is set when the mint is initialized, and doesn’t have to be
the account that created or paid for the mint.
A mint is owned by the Token Program and records supply, decimals, and authorities.The full details stored on each Mint Account include the following:
Mint Account State
pub struct Mint { /// Optional authority used to mint new tokens. The mint authority may only /// be provided during mint creation. If no mint authority is present /// then the mint has a fixed supply and no further tokens may be /// minted. pub mint_authority: COption<Pubkey>, /// Total supply of tokens. pub supply: u64, /// Number of base 10 digits to the right of the decimal place. pub decimals: u8, /// Is `true` if this structure has been initialized pub is_initialized: bool, /// Optional authority to freeze token accounts. pub freeze_authority: COption<Pubkey>,}
A token account
tracks one owner’s balance of one token. It stores:
Mint: The token the Token Account holds units of
Owner: The account authorized to transfer tokens from the Token Account
Amount: Number of the tokens the Token Account currently holds
A token account records its mint, its owner, and its balance.The full details stored on each Token Account include the following:
Token Account State
pub struct Account { /// The mint associated with this account pub mint: Pubkey, /// The owner of this account. pub owner: Pubkey, /// The amount of tokens this account holds. pub amount: u64, /// If `delegate` is `Some` then `delegated_amount` represents /// the amount authorized by the delegate pub delegate: COption<Pubkey>, /// The account's state pub state: AccountState, /// If is_native.is_some, this is a native token, and the value logs the /// rent-exempt reserve. An Account is required to be rent-exempt, so /// the value is used by the Processor to ensure that wrapped SOL /// accounts do not drop below this threshold. pub is_native: COption<u64>, /// The amount delegated pub delegated_amount: u64, /// Optional authority to close the account. pub close_authority: COption<Pubkey>,}
A wallet needs a token account, with itself as owner, for each mint it holds. A
wallet can own several token accounts for the same mint, but each token account
has one owner and one mint.
The Token Program owns mints and token accounts; a token account points to its mint and its owner.
A token account’s owner field names who controls the balance. That’s
different from the account’s program owner, which is always the token
program.
An associated token account (ATA) is the “default” token account for an owner
and a mint. It’s an ordinary token account at an address derived from the
owner’s address and the mint’s address, so anyone can find it.Creating an ATA requires a refundable minimum balance for its account storage.
The instruction’s payer funds that balance even when another wallet owns the
ATA. See
ATA cost and payer
for current costs and Token-2022 sizing differences.The ATA address is a program-derived address (PDA):
derived deterministically from fixed inputs.
An associated token account's address is derived from the wallet and the mint.Each wallet needs its own associated token account for each mint it holds.
Two wallets and two mints give four associated token accounts, one for each wallet and mint pair.