Compressed Accounts Program Examples

February 13, 2026 ยท View on GitHub

Ask DeepWiki to query the program examples in natural language and for help with debugging.

Examples

Airdrop Claim Reference Implementations

  • Basic: simple-claim - Distributes compressed tokens that get decompressed to SPL on claim with cliff.
  • Advanced: merkle-distributor - Distributes SPL tokens, uses compressed PDAs to track claims with linear vesting, partial claims and clawback. Based on Jito Merkle distributor and optimized with rent-free PDAs.

For simple client side distribution visit this example.

Basic Operations

  • create - Initialize a new compressed account
  • update - Modify data in an existing compressed account
  • close - Clear account data and preserve its address
  • reinit - Reinitialize a closed account with the same address
  • burn - Permanently delete a compressed account

Nullifier Program

  • nullifier-program - For some use cases, such as sending payments, you might want to prevent your onchain instruction from being executed more than once. Creates a rent-free PDA derived from an id. If the id has been used before, the PDA already exists, causing the instruction to fail. SDK: light-nullifier-program | Example client usage

Counter Program

Full compressed account lifecycle (create, increment, decrement, reset, close):

Create-and-update Program

  • create-and-update - Create a new compressed account and update an existing compressed account with a single validity proof in one instruction.

Create-and-read Program

  • read-only - Create a new compressed account and read it onchain.

Compare Program with Solana vs Compressed Accounts

ZK Programs

  • zk-id - Identity verification using Groth16 proofs. Issuers create credentials; users prove ownershp without revealing the credential.
  • nullifier - Simple Program to Create Nullifiers.

Light Protocol dependencies

Rust Crates

  • light-sdk - Core SDK for compressed accounts in native and anchor programs
  • light-sdk-pinocchio Core SDK for compressed accounts in pinocchio programs
  • light-hasher - Hashing utilities for ZK compression
  • light-client - RPC client and indexer for interacting with compressed accounts
  • light-program-test - Testing utilities for compressed programs.

TypeScript/JavaScript Packages

  • @lightprotocol/stateless.js@0.22.1-alpha.1 - Client library for interacting with compressed accounts
  • @lightprotocol/zk-compression-cli@0.27.1-alpha.2 - Command-line tools for ZK compression development

Prerequisites

Required versions:

  • Rust: 1.90.0 or later
  • Solana CLI: 2.3.11
  • Anchor CLI: 0.31.1
  • Zk compression CLI: 0.27.1-alpha.2 or later
  • Node.js: 23.5.0 or later

Install the Light CLI:

$ npm -g i @lightprotocol/zk-compression-cli@0.27.1-alpha.2

Install Solana CLI:

sh -c "$(curl -sSfL https://release.solana.com/v2.3.11/install)"

Install Anchor CLI:

cargo install --git https://github.com/coral-xyz/anchor avm --force
avm install latest
avm use 0.31.1

Getting Started with your own Program

  1. install the light cli
$ npm -g i @lightprotocol/zk-compression-cli@0.27.1-alpha.2
  1. instantiate a template Solana program with compressed accounts
$ light init <project-name>

Learn More