Skip to content

Latest commit

 

History

History
289 lines (230 loc) · 43.9 KB

File metadata and controls

289 lines (230 loc) · 43.9 KB
name solana-rent-free-dev
description Skill for Solana development using rent-free primitives from Light Protocol. Covers client development (TypeScript, Rust) and program development (Rust) across Anchor, native Rust, and Pinocchio. Focus areas include DeFi and Payments (Light Token, Light-PDA). Other use cases include airdrops and token distribution (Compressed Token), and user/app state plus nullifiers for payments and ZK applications (Compressed PDA).
compatibility Requires ZK Compression CLI, Solana CLI, Anchor CLI, and Node.js.
metadata
mintlify-proj openclaw
lightprotocol
requires
env bins
node
solana
anchor
cargo
light
allowed-tools
Read
Glob
Grep
Task
WebSearch
mcp__zkcompression__SearchLightProtocol
mcp__deepwiki__ask_question

Capabilities

ZK Compression is a framework on Solana for stablecoin payment rails, consumer apps and defi. The Light SDK and APIs let you create mint, token and PDA accounts >99% cheaper with familiar Solana developer experience.

Primitives

Primitive Use case Constraints
Light Token Most token use cases (launchpads, DeFi, payments). Rent-free mint and token accounts. ~200x cheaper than SPL and more compute-unit efficient on the hot path.
Light-PDA DeFi program state such as AMM pools and vaults. ~98% cheaper than PDAs and can be implemented with minimal code changes.
Compressed Token Only for Airdrops and token distribution. Prefer Light Token for other purposes. Used by Light Token under the hood for rent-free storage of inactive Light Tokens. Supported by Phantom and Backpack. Do not use for general-purpose token features. Use Light Token instead.
Compressed PDA User state and app state, nullifiers (payments and ZK applications), DePIN nodes, and stake accounts. Similar to program-derived addresses without a rent-exempt balance. Not for shared state, pool accounts, or config accounts. Use Light-PDA instead

View a complete API comparison to SPL and Solana: https://www.zkcompression.com/api-reference/solana-to-light-comparison.

Creation cost and Compute Unit Consumption

Metric Light Standard Solana
Mint Account ~0.00001 SOL ~0.0015 SOL
Token Account ~0.00001 SOL ~0.0029 SOL
PDA (100-byte) ~0.0000115 SOL ~0.0016 SOL
Associated token account creation 4,348 CU 14,194 CU
Transfer 312 CU 4,645 CU
Transfer (rent-free) 1,885 CU 4,645 CU

Install

Install orchestrator agent skill or view skill.md:

npx skills add https://zkcompression.com

Install or view dedicated agent skills.

npx skills add Lightprotocol/skills

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 and skills
  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: spawn subagent with Read, Glob, Grep, DeepWiki MCP access and load skills/ask-mcp

Skills

Use case Skill
Skill for payment flows using Light Token APIs for sponsored rent-exemption. payments
For Solana program development with tokens and PDAs, Light is 200x cheaper than SPL/ Solana and has minimal code differences light-sdk
For client development with tokens on Solana, Light Token is 200x cheaper than SPL and has minimal changes light-token-client
For data pipelines, aggregators, or indexers, real-time account state streaming on Solana with light account hot/cold lifecycle tracking data-streaming
For token distribution on Solana 5000x cheaper than SPL (rewards, airdrops, depins, ...) token-distribution
For custom ZK Solana programs and privacy-preserving applications to prevent double spending zk-nullifier
For program development on Solana with infrequently accessed state, such as per-user state, DePIN registrations, ... solana-compression
For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation testing
For questions about compressed accounts, Light SDK, Solana development, Claude Code features, or agent skills ask-mcp

Context

light-token

A token standard functionally equivalent to SPL that stores mint and token accounts more efficiently.

Mint accounts represent a unique mint and optionally store token-metadata. Functionally equivalent to SPL mints.

Token accounts hold balances from any light, SPL, or Token-2022 mint, without paying rent-exemption.

The token program pays rent-exemption cost for you. When an account has no remaining sponsored rent, the account is automatically compressed. Your tokens are cryptographically preserved as a compressed token account (rent-free). The account is loaded into hot account state in-flight when someone interacts with it again.

Use for: Stablecoin Orchestration, Cards, Agent Commerce, Defi, ... .

light-PDA

The Light-SDK pays rent-exemption for your PDAs, token accounts, and mints (98% cost savings). Your program logic stays the same.

After extended inactivity (multiple epochs without writes), accounts auto-compress to cold state. Your program only interacts with hot accounts. Clients load cold accounts back on-chain via create_load_instructions.

Area Change
State struct Derive LightAccount, add compression_info: CompressionInfo
Accounts struct Derive LightAccounts, add #[light_account] on init accounts
Program module Add #[light_program] above #[program]
Instructions No changes

Use for: DeFi program state, AMM pools, vaults.

Compressed token (only use for token distribution)

Compressed token accounts store token balance, owner, and other information of tokens like SPL and light-tokens. Compressed token accounts are rent-free. Any light-token or SPL token can be compressed/decompressed at will. Supported by Phantom and Backpack.

Only use for: airdrops, token distribution without paying upfront rent per recipient.

Compressed PDA

Compressed PDAs are derived using a specific program address and seed, like regular PDAs. Custom programs invoke the Light System program to create and update accounts, instead of the System program.

Persistent unique identification. Program ownership. CPI between compressed and regular PDAs.

Use rent-free PDAs for: user state, app state, nullifiers for payments, DePIN node accounts, stake accounts, nullifiers for zk applications. Not for shared state, pool, and config accounts.

Guidelines

  • light-token ≠ compressed token. light-token is a Solana account in hot state. Compressed token is a compressed account, always compressed, rent-free.
  • light-PDA ≠ compressed PDA. light-PDA is a Solana PDA that transitions to compressed state when inactive. Compressed PDA is always compressed, derived like a PDA and requires a validity proof.
  • light-token accounts hold SPL and Token-2022 balances, not just light-mint balances.
  • When sponsored rent on a light-token or light-PDA runs out, the account compresses. It decompresses on next interaction.

Payment Flows

Name Description Docs Examples
Overview Learn how the Light Token APIs reduce account creation cost for stablecoin payment infrastructure by 99% with similar developer experience to SPL / Token 2022. overview
Basic payment Send a single token transfer with Light Token APIs for stablecoin payments with comparison to SPL. basic-payment basic-send-action | basic-send-instruction
Batch payments Send payments to multiple recipients in a single transaction or sequentially. batch-payments batch-send
Payment with memo Attach invoice IDs, payment references, or notes to Light Token transfers using Solana's memo program. The memo is recorded in the transaction logs for reconciliation. payment-with-memo payment-with-memo
Receive payments Prepare to receive token payments by loading cold accounts and sharing your associated token account address. receive-payments receive
Verify payments Query token balances and transaction history to verify incoming payments. verify-payments get-balance | get-history
Verify address Verify recipient addresses before sending payments. Address validation prevents sending tokens to invalid or unexpected account types. verify-recipient-address verify-address
Wrap and unwrap Move tokens between SPL / Token 2022 and Light Token accounts for interoperability with applications that don't support Light Token yet. wrap-unwrap wrap | unwrap
Spend permissions Delegate token spending to a third party with an amount cap. The delegate can transfer tokens on behalf of the owner up to the approved amount, without the owner signing each transaction. spend-permissions delegate-full-flow
Nullifier PDAs Create rent-free nullifier PDAs to prevent duplicate actions. nullifier-pda
Production readiness Non-exhaustive checklist for deploying Light Token payment flows to production, including RPC infrastructure, error handling, and security. production-readiness
Wallet integration Guide for Wallet Applications to add Light-token support. wallets/overview
Sign with Privy Integrate light-token with Privy embedded wallets for rent-free token accounts and transfers. privy sign-with-privy
Sign with Wallet Adapter Integrate light-token with Solana Wallet Adapter for rent-free token accounts and transfers. wallet-adapter sign-with-wallet-adapter
Gasless transactions Abstract SOL fees so users never hold SOL. Sponsor top-ups and transaction fees by setting your application as the fee payer. gasless-transactions gasless-transactions

Examples

TypeScript client (@lightprotocol/compressed-token)

Operation Docs guide GitHub example
createMintInterface create-mint action | instruction
createAtaInterface create-ata action | instruction
mintToInterface mint-to action | instruction
transferInterface transfer-interface action | instruction
approve approve-revoke action
revoke approve-revoke action
delegateTransfer transfer-delegated action
wrap wrap-unwrap action | instruction
unwrap wrap-unwrap action | instruction
loadAta load-ata action | instruction
createAtaExplicitRentSponsor action
createSplInterface add-interface-pda action | instruction
createSplMint create-mint action | instruction
createT22Mint create-mint action | instruction
createTokenPool instruction

Rust client (light-token-client)

Operation Docs guide GitHub example
CreateMint create-mint action | instruction
CreateAta create-ata action | instruction
CreateTokenAccount create-token-account instruction
MintTo mint-to action | instruction
TransferInterface transfer-interface action | instruction
TransferChecked transfer-checked action | instruction
Approve approve-revoke action | instruction
Revoke approve-revoke action | instruction
Burn burn instruction
BurnChecked burn instruction
Freeze freeze-thaw instruction
Thaw freeze-thaw instruction
Close close-token-account instruction
Wrap wrap-unwrap action
Unwrap wrap-unwrap action
MintToChecked mint-to instruction
SplToLightTransfer instruction

Program examples (light_token)

Description
escrow Peer-to-peer light-token swap with offer/accept flow
fundraiser Token fundraiser with target, deadline, and refunds
light-token-minter Create light-mints with metadata, mint tokens
token-swap AMM with liquidity pools and swaps (Anchor)
cp-swap-reference Fork of Raydium AMM that creates markets without paying rent-exemption
pinocchio-swap AMM with liquidity pools and swaps (Pinocchio)
create-and-transfer Create account via macro and transfer via CPI

Program macros (light_token)

Description
counter Create PDA with sponsored rent-exemption
create-ata Create associated light-token account
create-mint Create light-token mint
create-token-account Create light-token account

CPI instructions (light_token)

CPI calls can be combined with existing and/or light macros. The API is a superset of SPL-token.

Operation Docs guide GitHub example
CreateAssociatedAccountCpi create-ata src
CreateTokenAccountCpi create-token-account src
CreateMintCpi create-mint src
MintToCpi mint-to src
MintToCheckedCpi mint-to src
BurnCpi burn src
TransferCheckedCpi transfer-checked src
TransferInterfaceCpi transfer-interface src
ApproveCpi approve-revoke src
RevokeCpi approve-revoke src
FreezeCpi freeze-thaw src
ThawCpi freeze-thaw src
CloseAccountCpi close-token-account src

SDK references

TypeScript packages

Package npm
@lightprotocol/stateless.js npm
@lightprotocol/compressed-token npm

Rust crates

Crate docs.rs
light-sdk docs.rs/light-sdk
light-sdk-pinocchio docs.rs/light-sdk-pinocchio
light-token docs.rs/light-token
light-token-client docs.rs/light-token-client
light-compressed-token-sdk docs.rs/light-compressed-token-sdk
light-client docs.rs/light-client
light-program-test docs.rs/light-program-test
light-account-pinocchio docs.rs/light-account-pinocchio
light-token-pinocchio docs.rs/light-token-pinocchio
light-hasher docs.rs/light-hasher
light-account docs.rs/light-account

For additional documentation and navigation, see: https://www.zkcompression.com/llms.txt For additional skills, see: https://github.com/Lightprotocol/skills