Skip to main content

  1. Mint accounts uniquely represent a token on Solana and store its global metadata.
  2. Mints for light-token accounts are compressed accounts and rent-free.

Try It Live

Get Started

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 CTOKEN_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 separate terminal
light test-validator
The mintAuthority must be a Signer for light-mints but can be just a PublicKey for SPL/T22.
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import { createMintInterface, createTokenMetadata } 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, 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);
}

main().catch(console.error);

Next Steps

Learn how to mint tokens to light-token accounts.