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.
  1. The rent-exemption for light account creation is sponsored by the Light Token Program.
  2. Transaction payer’s pay rent
    to keep accounts “active”
  3. “Inactive” accounts (rent below one epoch) get automatically compressed.
  4. The account’s state is cryptographically preserved and will be loaded into hot account state in-flight, when the account is used again.
The hot state fee is paid for by the transaction payer when writing to the respective account:
  • At account creation ~17,208 lamports
    and .
  • When the account’s rent is below 3h, the transaction payer tops up 776 lamports.
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 T22 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@alpha \
            @lightprotocol/compressed-token@alpha
Install the CLI globally:
npm install -g @lightprotocol/zk-compression-cli@alpha
# 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/T22.
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!}`;
// localnet:
// const RPC_URL = undefined;
const payer = Keypair.fromSecretKey(
    new Uint8Array(
        JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8"))
    )
);

(async function () {
    // devnet:
    const rpc = createRpc(RPC_URL);
    // localnet:
    // const rpc = createRpc();

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

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

Next Steps

Mint to Light Token Accounts