compressed-pda
Installation
SKILL.md
Compressed PDA Programs
Build Solana programs with compressed accounts via CPI to the Light System Program. No rent-exemption required.
| Creation cost | Solana account | Compressed account |
|---|---|---|
| PDA (100 bytes) | ~1,600,000 lamports | ~15,000 lamports |
When to use compressed PDAs
- Per-user state (profiles, game state, credentials)
- DePIN device registrations
- Nullifier-based double-spend prevention
- Infrequently accessed accounts
How it works
A program derives a compressed PDA like a regular PDA, then invokes the Light System Program (not the System Program) via CPI to create and update it. Creating an account requires a validity proof that the derived address does not yet exist; updates, closes, and burns require a proof that the account exists. Clients fetch proofs with getValidityProof from an RPC provider that supports ZK compression. The program loads accounts with LightAccount::new_init() (create) or LightAccount::new_mut() (update) and builds the CPI manually.