solana-compression-dev
by @tilo-14
For client and program development on Solana ~160x cheaper and without rent-exemption for per-user state, DePIN registrations, or custom compressed accounts....
clawhub install solana-compression-devπ About This Skill
name: solana-compression description: "For client and program development on Solana ~160x cheaper and without rent-exemption for per-user state, DePIN registrations, or custom compressed accounts. Create, update, close, burn, and reinitialize compressed accounts." metadata: source: https://github.com/Lightprotocol/skills documentation: https://www.zkcompression.com openclaw: requires: env: ["API_KEY"] # Helius or Triton RPC key; only needed for devnet/mainnet config: ["~/.config/solana/id.json"] # Solana keypair; only needed for devnet/mainnet bins: ["node", "solana", "anchor", "cargo", "light"] allowed-tools: Bash(git:*), Bash(cargo:*), Bash(anchor:*), Bash(light:*), Read, Edit, Glob, Grep, Write, Task, WebFetch, WebSearch, mcp__deepwiki__ask_question
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 (128 bytes) | ~1,100,000 lamports | ~5,000 lamports |
When to use compressed PDAs
Choosing approach
| Criteria | Light-PDA (easy) | Compressed PDA (advanced) |
|----------|-----------------|--------------------------|
| When | Rent-free version of existing Anchor accounts | Custom compressed state with ZK proofs |
| Skill | light-sdk (Anchor macro pattern) | This skill (solana-compression) |
| Macro | #[light_account(init)] | LightAccount::new_init() manual CPI |
| Dependencies | light-sdk, light-compressible | light-sdk, light-sdk-types |
If you just want rent-free Anchor accounts, use the light-sdk skill instead. This skill is for programs that require manual CPI to the Light System Program (custom compressed state, ZK proofs, address derivation).
Client-program interaction flow
ββ Client
β ββ Get ValidityProof from RPC.
β ββ pack accounts with PackedAccounts into PackedAddressTreeInfo and PackedStateTreeInfo.
β ββ pack CompressedAccountMeta.
β ββ Build Instruction from PackedAccounts and CompressedAccountMetas.
β ββ Send transaction.
β
ββ Custom Program
ββ CpiAccounts parse accounts consistent with PackedAccounts.
ββ LightAccount instantiates from CompressedAccountMeta.
β
ββ Light System Program CPI
ββ Verify ValidityProof.
ββ Update State Merkle tree.
ββ Update Address Merkle tree.
ββ Complete atomic state transition.
Domain references
| Topic | Reference | |-------|-----------| | Program operations (create, update, close, burn, reinit) | references/compressed-pdas.md | | Client SDK (TypeScript + Rust) | references/client.md | | Nullifier PDAs (double-spend prevention) | references/nullifier-pdas.md | | Error codes (6000-16034) | references/error-codes.md |
Reference repos
Basic operations β create, update, close, reinit, burn (each with Anchor and Native variants)
Counter β full lifecycle (create, increment, decrement, reset, close):
light-sdk and Rust testslight-sdk-pinocchio and Rust testsOther examples:
Nullifier:
light-nullifier-program | example clientAirdrop claim:
ZK programs:
Additional: examples-zk-compression β More ZK compression examples
Canonical source: program-examples README. If cloned locally, scope Read, Glob, Grep to these repositories and the current project directory only.
Workflow
1. Clarify intent
- Recommend plan mode, if it's not activated
- Use AskUserQuestion to resolve blind spots
- All questions must be resolved before execution
2. Identify references
- Match task to domain references and reference repos
- Locate relevant documentation and examples
3. Write plan file (YAML task format)
- Use AskUserQuestion for anything unclear β never guess or assume
- Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
4. Execute
- Use Task tool with subagents for parallel research
- Subagents load skills via Skill tool
- Track progress with TodoWrite
5. When stuck: ask to spawn a read-only subagent with Read, Glob, Grep, and DeepWiki MCP access, loading skills/ask-mcp. Scope reads to skill references, example repos, and docs.
Build and test
Required commands
Anchor programs:
anchor build
anchor test
Native programs:
cargo build-sbf
cargo test-sbf
Forbidden shortcuts
cargo build (must use cargo build-sbf)cargo test (must use cargo test-sbf)Failure recovery
On failure, spawn debugger agent with error context.
Loop rules: 1. Each debugger gets fresh context + previous debug reports 2. Each attempt tries something DIFFERENT 3. NEVER GIVE UP - keep spawning until fixed 4. Max 5 attempts per error
Do NOT proceed until all tests pass.
SDK references
| Package | Link |
|---------|------|
| light-sdk | docs.rs |
| light-client | docs.rs |
| @lightprotocol/stateless.js | API docs |
| light-program-test | docs.rs |
DeepWiki fallback
If no matching pattern in reference repos:
mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "How to {operation}?")
Security
This skill provides code patterns and documentation references only.
API_KEY (Helius or Triton RPC key) and read ~/.config/solana/id.json for the payer keypair. Neither is needed on localnet. In production, load both from a secrets manager.Read, Glob, and Grep must be limited to the current project directory and the reference repos listed above. Do not read outside these paths.Read, Glob, Grep scoped to skill references, example repos, and docs.npx skills add Lightprotocol/skills from Lightprotocol/skills.