Skip to content

Lightprotocol/program-examples

Repository files navigation

Compressed Accounts Program Examples

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

Examples

Basic Operations

Basic Operations include:

  • 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.

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 uncompressed vs compressed accounts Program

zk-id Program

  • zk-id - A minimal zk id Solana program that uses zero-knowledge proofs for identity verification with compressed accounts.

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

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/[email protected]

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/[email protected]
  1. instantiate a template Solana program with compressed accounts
$ light init <project-name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published