← 返回
开发者工具 中文

solana-light-sdk

For Solana program development with tokens and PDAs, Light is 200x cheaper than SPL/ Solana and has minimal code differences (e.g. for any Solana program and...
针对涉及代币和PDA的Solana程序开发,Light比SPL/Solana便宜200倍,且代码差异极小(例如,对于任何Solana程序……)。
tilo-14
开发者工具 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 816
下载
💾 10
安装
1
版本
#latest

概述

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 / SPLLight SDK
:----------------------:------------------:-------------------
Token account~2,000,000 lamports~11,000 lamports
Avg. DeFi pool~$2~$0.02

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

Domain References

AudienceReference
-----------------
Anchor patternreferences/anchor.md
Pinocchio patternreferences/pinocchio.md
Client SDK (LightProgramInterface)references/client-sdk.md
Testingreferences/testing.md
CPI instructionsreferences/instructions.md
FAQreferences/faq.md
Router integrationreferences/router.md

When to use which

CriteriaAnchorPinocchio
-----------------------------
Frameworkanchor-lang 0.31, #[light_program] macropinocchio 0.9, LightProgramPinocchio derive
State structOption + LightAccount deriveCompressionInfo (non-optional) + bytemuck::Pod + Zeroable + #[repr(C)]
Account creation#[light_account(init, ...)] attribute or CreateTokenAccountCpiCreateTokenAccountCpi, CreateMints batch pattern
Compress/decompress handlersAuto-generated by #[light_program] macroRoute ProgramAccounts::COMPRESS_ACCOUNTS_IDEMPOTENT etc. in entrypoint
Program ID constantNot needed (macro derives it)pub const ID: Pubkey = pubkey_array!(...) + LIGHT_CPI_SIGNER required
Dependencieslight-sdk, light-sdk-macros, light-token, light-anchor-spllight-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:

TaskReference
-----------------
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)
---------
StorageOn-chainCompressed
LatencyNormal+0-200ms
Tx sizeNormal+100-2400 bytes
CUNormal+15k-400k CU
Program codeNo changeNo change

The hot path has zero overhead.

External References

ResourceLink
----------------
Anchor AMM referencecp-swap-reference
Pinocchio swap referencepinocchio-swap
Anchor counter (rent-free PDA)basic-macros/counter
Pinocchio counter (zero-copy PDA)pinocchio/counter

SDK references

PackageLink
---------------
light-sdkdocs.rs
light-sdk-macrosdocs.rs
light-sdk-pinocchiodocs.rs
light-tokendocs.rs
light-token-pinocchiodocs.rs
light-account-pinocchiodocs.rs
light-token-clientdocs.rs
light-clientdocs.rs
light-program-testdocs.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/skills installs 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, and Grep to 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.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 22:52 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

solana-token-distribution

tilo-14
Solana代币分发比SPL便宜5000倍,用于奖励、空投等场景。@lightprotocol/compressed-token (TypeScript)。参考示例...
★ 0 📥 753
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 65 📥 179,837
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 666 📥 323,786