Skip to main content

  1. Mint accounts uniquely represent a token on Solana and store its global metadata.
  2. Light mints are on-chain accounts like SPL mints, but the light token program sponsors the rent-exemption cost for you.
  3. Add an interface PDA to existing SPL or Token 2022 mints for interoperability with Light Token. The interface PDA holds SPL or Token 2022 tokens when wrapped to Light Token.
  1. A rent sponsor PDA by Light Protocol pays the rent-exemption cost for the account.
  2. Transaction fee payers bump a virtual rent balance when writing to the account, which keeps the account “hot”.
  3. “Cold” accounts virtual rent balance below threshold (eg 24h without write bump) get auto-compressed.
  4. The cold account’s state is cryptographically preserved on the Solana ledger. Users can load a cold account into hot state in-flight when using the account again.
Install the agent skill:
npx skills add https://zkcompression.com
See the AI tools guide for dedicated skills.
createMintInterface is a unified interface that dispatches to different mint creation paths based on programId:
  • TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID → delegates to SPL or Token 2022 createMint
  • Otherwise it defaults to LIGHT_TOKEN_PROGRAM_ID → creates a Light Token mint
You can use the same interface regardless of mint type.Compare to SPL:
Find the source code here.
1

Create Mint with Token Metadata

Install packages in your working directory:
npm install @lightprotocol/stateless.js@beta \
            @lightprotocol/compressed-token@beta
Install the CLI globally:
npm install -g @lightprotocol/zk-compression-cli@beta
# start local test-validator in a separate terminal
light test-validator
In the code examples, use createRpc() without arguments for localnet.
The mintAuthority must be a Signer for light-mints but can be just a PublicKey for SPL/Token 2022.
import "dotenv/config";
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import {
    createMintInterface,
    createTokenMetadata,
} from "@lightprotocol/compressed-token";
import { homedir } from "os";
import { readFileSync } from "fs";

// devnet:
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const rpc = createRpc(RPC_URL);
// localnet:
const rpc = createRpc();

const payer = Keypair.fromSecretKey(
    new Uint8Array(
        JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8"))
    )
);

(async function () {
    const { mint, transactionSignature } = await createMintInterface(
        rpc,
        payer,
        payer,
        null,
        9,
        undefined, // keypair
        undefined, // confirmOptions (default)
        undefined, // programId (CTOKEN_PROGRAM_ID)
        createTokenMetadata(
            "Example Token",
            "EXT",
            "https://example.com/metadata.json"
        )
    );

    console.log("Mint:", mint.toBase58());
    console.log("Tx:", transactionSignature);
})();

Create SPL mint with interface PDA

Pass TOKEN_PROGRAM_ID to create a standard SPL mint with an interface PDA in one transaction for interoperability with Light Token.
import "dotenv/config";
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import { createMintInterface } from "@lightprotocol/compressed-token";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { homedir } from "os";
import { readFileSync } from "fs";

// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();

const payer = Keypair.fromSecretKey(
    new Uint8Array(
        JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8"))
    )
);

(async function () {
    // Creates SPL mint + SPL Interface PDA in one transaction
    const mintKeypair = Keypair.generate();
    const { mint, transactionSignature } = await createMintInterface(
        rpc,
        payer,
        payer,
        null,
        9,
        mintKeypair,
        undefined,
        TOKEN_PROGRAM_ID
    );

    console.log("Mint:", mint.toBase58());
    console.log("Tx:", transactionSignature);
})();

Create Token 2022 mint with interface PDA

Pass TOKEN_2022_PROGRAM_ID to create a Token-2022 mint with an interface PDA in one transaction for interoperability with Light Token.
import "dotenv/config";
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import { createMintInterface } from "@lightprotocol/compressed-token";
import { TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
import { homedir } from "os";
import { readFileSync } from "fs";

// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();

const payer = Keypair.fromSecretKey(
    new Uint8Array(
        JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8"))
    )
);

(async function () {
    // Creates Token-2022 mint and SPL interface PDA in one transaction
    // SPL interface PDA holds Token-2022 tokens when wrapped to light-token
    const mintKeypair = Keypair.generate();
    const { mint, transactionSignature } = await createMintInterface(
        rpc,
        payer,
        payer,
        null,
        9,
        mintKeypair,
        undefined,
        TOKEN_2022_PROGRAM_ID
    );

    console.log("Mint:", mint.toBase58());
    console.log("Tx:", transactionSignature);
})();

Add interface PDA

Mint tokens


Didn’t find what you were looking for?

Reach out! Telegram | email | Discord