Overview

Complete overview to compressed tokens core features, setup guide and cookbook.

Compressed tokens provide full SPL token functionality without per-account rent cost.

Creation
Regular SPL Token
Compressed Token
Cost Reduction

100 Token Accounts

~ 0.2 SOL

~ 0.00004 SOL

5000x

Compressed token accounts store information about an individual's ownership of a specific token (mint). Different from regular token accounts, they don't require an Associated Token Account (ATA) per token holder.

For example, this simplifies token distribution, since you don't need to allocate a token account per recipient.

Compressed Tokens at a Glance

Rent-free tokens

Create token accounts without upfront rent exempt balance.

SPL Compatibility

Compatible with SPL tokens and Solana programs.

Wallet Support

Supported by leading wallets including Phantom and Backpack.

Start building

Developing with compressed tokens works similar SPL tokens and involves minimal setup:

  1. Install dependencies

npm install --save-dev typescript tsx @types/node && \
npm install --save \
    @lightprotocol/stateless.js \
    @lightprotocol/compressed-token \
    @solana/web3.js \
    @solana/spl-token
  1. Set up your developer environment

Setup Developer Environment

By default, all guides use Localnet.

# Install the development CLI
npm install @lightprotocol/zk-compression-cli
# Start a local test validator
light test-validator

## ensure you have the Solana CLI accessible in your system PATH 
// createRpc() defaults to local test validator endpoints
import {
  Rpc,
  createRpc,
} from "@lightprotocol/stateless.js";

const connection: Rpc = createRpc();

async function main() {
  let slot = await connection.getSlot();
  console.log(slot);

  let health = await connection.getIndexerHealth(slot);
  console.log(health);
  // "Ok"
}

main();

Alternative: Using Devnet

Replace <your-api-key> with your actual API key. Get your API key here, if you don't have one yet.

import { createRpc } from "@lightprotocol/stateless.js";

// Helius exposes Solana and Photon RPC endpoints through a single URL
const RPC_ENDPOINT = "https://devnet.helius-rpc.com?api-key=<your_api_key>";
const connection = createRpc(RPC_ENDPOINT, RPC_ENDPOINT, RPC_ENDPOINT);

console.log("Connection created!");
console.log("RPC Endpoint:", RPC_ENDPOINT);
  1. Get started with our cookbook or advanced guides for implementations

Cookbook

Guide
Description

Create new SPL mint with token pool for compression

Difference to regular token accounts

Create new compressed tokens to existing mint

Move compressed tokens between compressed accounts

Convert SPL tokens between regular and compressed format

Compress complete SPL token accounts and reclaim rent afterwards

Consolidate multiple compressed accounts of the same mint into a single compressed account

Create token pool for compression for existing SPL mints

Approve or revoke delegates for compressed token accounts

Advanced Guides

Guide
Description

Create an airdrop with or without code

Create and transfer compressed tokens with Token-2022 extensions

Implement compressed token support in your wallet application


Next Steps

Get started with the first cookbook guide.

How to Create and Register a Mint Account for Compression

Last updated