Skip to main content

  1. Associated light-token accounts are Solana accounts that hold token balances of light, SPL, or Token 2022 mints.
  2. The address for light-ATAs is deterministically derived with the owner’s address, compressed token program ID, and mint address.
  3. Associated light-token accounts implement a default rent config:
    1. At account creation, you pay ~17,208 lamports
      and (the rent-exemption is sponsored by the protocol)
    2. Transfers keep the account funded via top-ups. The transaction payer tops up 776 lamports when the account’s rent is below 3h.
  1. The rent-exemption for light-token account creation is sponsored by Light Protocol.
  2. Transaction payer’s pay rent
    to keep accounts “active”.
  3. “Inactive” accounts, where rent is below one epoch, are compressed
    and the rent-exemption can be claimed by the rent sponsor.
  4. Transfers to inactive accounts (decompress).
This way rent is automatically paid when accounts are used:
EventTotal CostPayerTime of Rent funded
Account CreationTransaction payerFunds 24h rent
Automatic Top ups
(when rent < 3h)
776 lamportsTransaction payerFunds 3h rent
Load Account
(when inactive)
Transaction payerFunds 24h rent

Get Started

The createAtaInterface function creates an associated light-token account in a single call.Compare to SPL:
Find the source code here.
1

Create Associated Token Account

Install packages in your working directory:
npm install @lightprotocol/stateless.js@alpha \
            @lightprotocol/compressed-token@alpha
Install the CLI globally:
npm install -g @lightprotocol/zk-compression-cli@alpha
# Start local test-validator in separate terminal
light test-validator
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import { createMintInterface, createAtaInterface } from "@lightprotocol/compressed-token";

async function main() {
const rpc = createRpc();
const payer = Keypair.generate();
const sig = await rpc.requestAirdrop(payer.publicKey, 10e9);
await rpc.confirmTransaction(sig);

const { mint } = await createMintInterface(rpc, payer, payer, null, 9);

const owner = Keypair.generate();
const ata = await createAtaInterface(rpc, payer, mint, owner.publicKey);

console.log("ATA:", ata.toBase58());
}

main().catch(console.error);

Next Steps

Learn how to mint light-tokens