Arch Prime is coming soon.Stay updated
Arch Prime
Join the waitlist

Docs / Arch Program Library

Associated Token Account Program

Guide to the APL Associated Token Account Program for deterministic token account management

The Associated Token Account (ATA) Program derives and creates a standard token account for a wallet and mint. Applications can derive the same address without storing a separate token-account mapping.

Program ID

ATok9pxLsNzM5zJJ3UQpXBrMriHpZiY5Yio3GKYU4we3

In Rust, use apl_associated_token_account::id().

Address Derivation

An ATA is a PDA derived from three seeds:

  1. The wallet owner's public key
  2. The APL token program ID, apl_token::id()
  3. The token mint public key
let (ata_address, bump_seed) =
    apl_associated_token_account::get_associated_token_address_and_bump_seed(
        &wallet_pubkey,
        &mint_pubkey,
        &apl_associated_token_account::id(),
    );

Including the token program ID in the seed set prevents collisions between token programs.

Create Instruction

Use the helper from apl_associated_token_account rather than constructing account metas manually.

use arch_program::{pubkey::Pubkey, system_program};

let instruction = apl_associated_token_account::create_associated_token_account(
    &funder_pubkey,
    &ata_address,
    &wallet_pubkey,
    &mint_pubkey,
    &apl_token::id(),
    &system_program::id(),
);

The instruction expects these accounts:

IndexAccessAccount
0signer, writableFunding account
1writableAssociated token account PDA
2readonlyWallet owner
3readonlyToken mint
4readonlySystem program
5readonlyToken program

After creating the PDA account, the ATA program invokes the token program's initialize_account3 instruction.

Create with Bitcoin Anchor

When account creation must be anchored to a specific Bitcoin UTXO, use create_associated_token_account_with_anchor.

let instruction = apl_associated_token_account::create_associated_token_account_with_anchor(
    &funder_pubkey,
    &ata_address,
    &wallet_pubkey,
    &mint_pubkey,
    &apl_token::id(),
    &system_program::id(),
    txid,
    vout,
);

The helper serializes txid and vout into the 36-byte instruction payload expected by the ATA processor.

CLI Usage

arch-cli does not expose standalone create-associated-account or get-associated-account-address commands. The supported CLI flow is to create token accounts through arch-cli token create-account, or to let minting create the ATA automatically when appropriate:

arch-cli token mint \
  <MINT_ADDRESS> \
  <AMOUNT> \
  --authority <AUTHORITY_KEYPAIR> \
  --auto-create-ata

Use the Rust helpers above when you need custom ATA instructions in an application client.

Best Practices

  • Derive ATAs with get_associated_token_address_and_bump_seed.
  • Always include apl_token::id() and the mint in the derivation.
  • Use the helper constructors so account ordering matches the program.
  • Check whether the ATA already exists before submitting a create instruction.

Next Steps