light-sdk
Rent-Free Solana Programs
The Light SDK pays rent-exemption for PDAs, token accounts, and mints. Program logic stays mostly untouched.
| Rent cost (per account) | Solana / SPL | Light SDK |
|---|---|---|
| Token account | ~2,000,000 lamports | ~11,000 lamports |
| Avg. DeFi pool | ~$2 | ~$0.02 |
Workflow
- Clarify intent
- Recommend plan mode, if it's not activated
- Use
AskUserQuestionto resolve blind spots - All questions must be resolved before execution
- Identify references and skills
- Match task to domain references below
- Locate relevant documentation and examples
- Write plan file (YAML task format)
- Use
AskUserQuestionfor anything unclear — never guess or assume - Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
- Use
- Execute
- Use
Tasktool with subagents for parallel research - Subagents load skills via
Skilltool - Track progress with
TodoWrite
- Use
- When stuck: spawn subagent with
Read,Glob,Grep, DeepWiki MCP access and loadskills/ask-mcp
Domain References
| Audience | Reference |
|---|---|
| Anchor pattern | references/anchor.md |
| Pinocchio pattern | references/pinocchio.md |
| Client SDK (LightProgramInterface) | references/client-sdk.md |
| Testing | references/testing.md |
| CPI instructions | references/instructions.md |
| SPL to Light comparison | references/spl-to-light.md |
| FAQ | references/faq.md |
| Router integration | references/router.md |
When to use which
| Criteria | Anchor | Pinocchio |
|---|---|---|
| Framework | anchor-lang 0.31, #[light_program] macro |
pinocchio 0.9, LightProgramPinocchio derive |
| State struct | Option<CompressionInfo> + LightAccount derive |
CompressionInfo (non-optional) + bytemuck::Pod + Zeroable + #[repr(C)] |
| Account creation | #[light_account(init, ...)] attribute or CreateTokenAccountCpi |
CreateTokenAccountCpi, CreateMints batch pattern |
| Compress/decompress handlers | Auto-generated by #[light_program] macro |
Route ProgramAccounts::COMPRESS_ACCOUNTS_IDEMPOTENT etc. in entrypoint |
| Program ID constant | Not needed (macro derives it) | pub const ID: Pubkey = pubkey_array!(...) + LIGHT_CPI_SIGNER required |
| Dependencies | light-sdk, light-sdk-macros, light-token, light-anchor-spl |
light-account-pinocchio, light-token-pinocchio, bytemuck |
DeFi integration
For DeFi programs (AMMs, lending, vaults): the Anchor and Pinocchio patterns above apply directly. DeFi-specific references:
| Task | Reference |
|---|---|
| Router/aggregator integration (cold account loading) | references/router.md |
| LightProgramInterface trait (client SDK for routers) | references/client-sdk.md |
Hot vs Cold Model
After extended inactivity (multiple epochs without writes), accounts auto-compress to cold state. Programs only interact with hot accounts. Clients load cold accounts back on-chain via create_load_instructions.
| Hot (active) | Cold (inactive) | |
|---|---|---|
| Storage | On-chain | Compressed |
| Latency | Normal | +0-200ms |
| Tx size | Normal | +100-2400 bytes |
| CU | Normal | +15k-400k CU |
| Program code | No change | No change |
The hot path has zero overhead.
External References
| Resource | Link |
|---|---|
| Anchor AMM reference | cp-swap-reference |
| Pinocchio swap reference | pinocchio-swap |
| Anchor counter (rent-free PDA) | basic-macros/counter |
| Pinocchio counter (zero-copy PDA) | pinocchio/counter |
SDK references
| Package | Link |
|---|---|
light-sdk |
docs.rs |
light-sdk-macros |
docs.rs |
light-sdk-pinocchio |
docs.rs |
light-token |
docs.rs |
light-token-pinocchio |
docs.rs |
light-account-pinocchio |
docs.rs |
light-token-client |
docs.rs |
light-client |
docs.rs |
light-program-test |
docs.rs |
Security
This skill does not pull, store, or transmit external secrets. It provides code patterns, documentation references, and development guidance only.
- No credentials consumed. The skill requires no API keys, private keys, or signing secrets.
env: []is declared explicitly. - User-provided configuration. RPC endpoints, wallet keypairs, and authentication tokens (Privy, wallet adapters) are configured in the user's own application code — the skill only demonstrates how to use them.
- Install source.
npx skills add Lightprotocol/skillsinstalls from the public GitHub repository (Lightprotocol/skills). Verify the source before running. - Subagent scope. This skill may spawn read-only subagents that use
Read,Glob, andGrepto search the local repository. Restrict the working directory to your project. - Audited protocol. Light Protocol smart contracts are independently audited. Reports are published at github.com/Lightprotocol/light-protocol/tree/main/audits.
More from lightprotocol/skills
token-distribution
For token distribution on Solana 5000x cheaper than SPL (rewards, airdrops, depins, ...). @lightprotocol/compressed-token (TypeScript). Reference examples for custom claim support.
28zk-nullifier
For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.
27light-token-client
For client development with tokens on Solana, Light Token is 200x cheaper than SPL and has minimal changes. Skill includes guides for create mints, associated token accounts, transfer, approve, burn, wrap, and more. @lightprotocol/compressed-token (TypeScript) and light_token_client (Rust).
27solana-compression
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.
27ask-mcp
For questions about Light Protocol's SDK, smart contracts and Solana development, Claude Code features, or agent skills. AI-powered answers grounded in repository context via DeepWiki MCP.
26testing
For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation.
26