solana-compression-dev
简介
solana-compression-dev
原始描述
For client and program development on Solana ~160x cheaper and without rent-exemption for per-user state, DePIN registrations, or custom compressed accounts....
通过你的 Agent 添加
安装目录:solana-compression/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
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
- Per-user state (profiles, game state, credentials)
- DePIN device registrations
- Nullifier-based double-spend prevention
- Infrequently accessed accounts
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
| 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
├─ 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.
| 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):
- counter/anchor — Anchor with Rust and TypeScript tests
- counter/native — Native with
light-sdkand Rust tests - counter/pinocchio — Pinocchio with
light-sdk-pinocchioand Rust tests
Other examples:
- create-and-update — Create and update with a single validity proof in one instruction
- read-only — Create and read a compressed account onchain
- account-comparison — Compressed vs regular Solana accounts
Nullifier:
- nullifier-program — Rent-free PDA for duplicate execution prevention. SDK:
light-nullifier-program| example client
Airdrop claim:
- simple-claim — Compressed tokens decompressed to SPL on claim with cliff
- merkle-distributor — SPL tokens with compressed PDA claim tracking, linear vesting, partial claims, clawback
- example-token-distribution — Simple client-side distribution
ZK programs:
- zk-id — Identity verification with Groth16 proofs
- zk/nullifier — Simple nullifier creation program
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
- Clarify intent
- Recommend plan mode, if it's not activated
- Use
AskUserQuestion to resolve blind spots
- All questions must be resolved before execution
- Identify references
- Match task to domain references and reference repos
- Locate relevant documentation and examples
- 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
- Execute
- Use
Task tool with subagents for parallel research
- Subagents load skills via
Skill tool
- Track progress with
TodoWrite
- 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
- Recommend plan mode, if it's not activated
- Use
AskUserQuestionto resolve blind spots - All questions must be resolved before execution
- Match task to domain references and reference repos
- Locate relevant documentation and examples
- Use
AskUserQuestionfor anything unclear — never guess or assume - Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
- Use
Tasktool with subagents for parallel research - Subagents load skills via
Skilltool - Track progress with
TodoWrite
Read, Glob, Grep, and DeepWiki MCP access, loading skills/ask-mcp. Scope reads to skill references, example repos, and docs.Required commands
Anchor programs:
anchor build
anchor test
Native programs:
cargo build-sbf
cargo test-sbf
Forbidden shortcuts
- Do NOT use
cargo build (must use cargo build-sbf)
- Do NOT use
cargo test (must use cargo test-sbf)
- Do NOT skip SBF compilation
- Tests MUST run against real BPF bytecode
Failure recovery
cargo build (must use cargo build-sbf)cargo test (must use cargo test-sbf)On failure, spawn debugger agent with error context.
Loop rules:
- Each debugger gets fresh context + previous debug reports
- Each attempt tries something DIFFERENT
- NEVER GIVE UP - keep spawning until fixed
- 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
| Package | Link |
|---|---|
light-sdk |
docs.rs |
light-client |
docs.rs |
@lightprotocol/stateless.js |
API docs |
light-program-test |
docs.rs |
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.
- Declared dependencies. Devnet and mainnet examples require
API_KEY(Helius or Triton RPC key) and read~/.config/solana/id.jsonfor the payer keypair. Neither is needed on localnet. In production, load both from a secrets manager. - Filesystem scope.
Read,Glob, andGrepmust be limited to the current project directory and the reference repos listed above. Do not read outside these paths. - Subagent scope. When stuck, the skill asks to spawn a read-only subagent with
Read,Glob,Grepscoped to skill references, example repos, and docs. - Install source.
npx skills add Lightprotocol/skillsfrom Lightprotocol/skills. - Audited protocol. Light Protocol smart contracts are independently audited. Reports are published at github.com/Lightprotocol/light-protocol/tree/main/audits.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。