| Creation | Regular PDA Account | Compressed PDA | Cost Reduction |
|---|---|---|---|
| 100-byte PDA | ~ 0.0016 SOL | ~ 0.00001 SOL | 160x |
Compressed PDAs at a Glance
Rent free PDAs
Create accounts at program-derived addresses without upfront rent exempt balance.
Full PDA Functionality
Persistent unique identification and program ownership.
Composable
CPI support between compressed and regular PDAs.
Start Building
Developing with compressed PDAs works similar to regular PDAs and involves minimal setup:Prerequisites
Required versions:
- Rust: 1.86.0 or later
- Solana CLI: 2.2.15
- Anchor CLI: 0.31.1
- Zk compression CLI: 0.27.0 or later
- Node.js: 23.5.0 or later
Initialize your Program
Instantiate a template Solana program with compressed accounts with all required dependencies.The
light init command creates only Anchor-based projects . For Pinocchio programs, manually configure dependencies using light-sdk-pinocchio.Dependencies
Dependencies
Rust Crates
light-sdk- Core SDK for compressed accounts in native and anchor programslight-sdk-pinocchioCore SDK for compressed accounts in pinocchio programslight-client- RPC client and indexer for interacting with compressed accountslight-program-test- Testing utilities for compressed programs.
@lightprotocol/stateless.js- Client library for interacting with compressed accounts@lightprotocol/zk-compression-cli- Command-line tools for ZK compression development
Build and Test
Nowcd testprogram and run:
Common Errors
assert.h file not found - during compilation.
assert.h file not found - during compilation.
Program Examples
| Example | Description |
|---|---|
| basic-operations/anchor | Anchor programs to create, update, close, reinitialize and burn compressed accounts with Rust and TypeScript tests |
| basic-operations/native-rust | Native Solana program implementation to create, update, close, reinitialize and burn compressed accounts with Rust tests |
| Counter (Anchor) | Full compressed account lifecycle (create, increment, decrement, reset, close) using Anchor framework |
| Counter (Native) | Native Solana program implementation with Rust tests |
| Counter (Pinocchio) | Pinocchio implementation using light-sdk-pinocchio with Rust tests |
| Create-and-Update | Create new compressed accounts and update existing ones within a single instruction and one validity proof |
| Read-Only | Create compressed accounts and read them on-chain |
| Account Comparison | Compare compressed accounts with standard Solana accounts |
| ZK-ID | Program that uses zero-knowledge proofs for identity verification with compressed accounts |