7

The term "Associated Token Account" is often used when talking about tokens on Solana.

What is it?

4 Answers 4

6

According to Solana's official documentation:

A user may own arbitrarily many token accounts belonging to the same mint which makes it difficult for other users to know which account they should send tokens to and introduces friction into many other aspects of token management. This program introduces a way to deterministically derive a token account key from a user's main System account address and a token mint address, allowing the user to create a main token account for each token they own. We call these accounts Associated Token Accounts.

According to @Zantetsu

For a given mint, a given system address has exactly one Associated Token Account for that mint, not multiple. A given system account can have an arbitrary number of token accounts for a specific mint, but only one is at the specific address that makes it an Associated Token Account for that mint. That's the whole point of Associated Token Accounts - to provide a specific way to derive token account addresses so that they are at a known location for a given system account + mint.

But to ELI5 (Explain like I'm 5),

An Associated Token Account (ATA) is an account that stores a SPECIFIC type of "coin" or "currency" for its owner.

Suppose you have a (regular, physical, non-cryptocurrency) wallet.

Your wallet is able to stash a couple of debit/credit cards, some cash, maybe some USD, maybe some EUR.

Each of these variety of items are distinct Associated Token Accounts (ATAs).

Your (main) account (or wallet) owns several ATA, like

  1. An AMEX ATA
  2. A USD ATA that stores 5000 USD
  3. A EUR ATA that stores 1000 EUR

What's a token? A token simply means the currency type in layman terms.

4
  • 1
    "Of course, you can have multiple ATAs of the same token type." I thought the point of having an ATA was so that wallet software like Phantom can know where to send tokens to, given a receipient's system account. Doesn't having multiple ATA's for the same token type defeat this purpose?
    – itsfarseen
    Jul 15, 2022 at 9:59
  • 2
    @itsfarseen yes! But unfortunately, that's the case for how things would work. Eventually, this would become a power rather than "defeat this purpose". We'll eventually be able to sandbox exploits and isolate wallet drain events to a specific sub-account, where a specific ATA for USDC gets drained because its the only account interacting with the malicious counterparty.
    – Nicholas
    Jul 17, 2022 at 17:09
  • 2
    Nicholas is not correct. For a given mint, a given system address has exactly one Associated Token Account for that mint, not multiple. A given system account can have an arbitrary number of token accounts for a specific mint, but only one is at the specific address that makes it an Associated Token Account for that mint. That's the whole point of Associated Token Accounts - to provide a specific way to derive token account addresses so that they are at a known location for a given system account + mint. Jul 21, 2022 at 5:31
  • @Zantetsu-ShinobiSystems it would be good to add a reference to an official source, so readers know who is correct.
    – mikemaccana
    Aug 25, 2022 at 13:51
3

If you understand PDAs

an Associated Token Account (ATA) is a PDA derived from the SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID and with seeds:

  • wallet address
  • TOKEN_PROGRAM
  • mint address

This makes it for each user, a unique ATA will be created for that mint. Rather than creating multiple token accounts and having a hard time managing them.

2

An Associated Token account (ATA) is an account that holds a specific SPL token and is owned by a particular wallet. The account is deterministic, because it is created based on the specific token and the specific wallet it is associated with. When you transfer a SPL token, you are transfering to a different ATA which is associated with the wallet being transferred to and the specific token. Anyone can generate such an account since it is created deterministically.

1

We have mint accounts and token accounts. this is what mint accounts store:

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 Mint account just stores the general information about the token.

The token account stores information about the balances of each address. (in ethereum we use mappings). Each holding of this SPL token has a token account. Now when you send token from your token account to another holder, you need to write 1 transfer instruction for each account which is cumbersome.

Associate token account (ATA) is derived from owner's public key and a token mint. Similar to PDA. Actually every ATA is a PDA. So whenever you send a token to another holding, you just send it to its ATA

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.