返回顶部
l

light-sdkLight 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 Defi such as AMMs, vaults, lending). Includes rent-free Light-PDAs, token accounts, and mints. Light SDK with Anchor or Pinocchio. Includes for Defi Router integration guide. Minimal program logic changes.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
389
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

light-sdk

免租金Solana程序

Light SDK为PDA、代币账户和铸币账户支付免租费用。程序逻辑基本保持不变。

租金成本(每个账户)Solana / SPLLight SDK
代币账户~2,000,000 lamports~11,000 lamports
平均DeFi池
~$2 | ~$0.02 |

工作流程

  1. 1. 明确意图
- 推荐计划模式(如果尚未激活) - 使用AskUserQuestion解决盲点 - 执行前必须解决所有问题
  1. 2. 识别参考资料和技能
- 将任务匹配到下方的领域参考资料 - 定位相关文档和示例
  1. 3. 编写计划文件(YAML任务格式)
- 对任何不明确的内容使用AskUserQuestion——切勿猜测或假设 - 识别阻塞因素:权限、依赖项、未知项 - 执行开始前计划必须完整
  1. 4. 执行
- 使用带子代理的Task工具进行并行研究 - 子代理通过Skill工具加载技能 - 使用TodoWrite跟踪进度
  1. 5. 遇到困难时:生成具有Read、Glob、Grep、DeepWiki MCP访问权限的子代理,并加载skills/ask-mcp

领域参考资料

受众参考资料
Anchor模式references/anchor.md
Pinocchio模式
references/pinocchio.md | | 客户端SDK(LightProgramInterface) | references/client-sdk.md | | 测试 | references/testing.md | | CPI指令 | references/instructions.md | | 常见问题 | references/faq.md | | 路由器集成 | references/router.md |

何时使用哪种模式

标准AnchorPinocchio
框架anchor-lang 0.31,#[light_program]宏pinocchio 0.9,LightProgramPinocchio派生
状态结构体
Option + LightAccount派生 | CompressionInfo(非可选)+ bytemuck::Pod + Zeroable + #[repr(C)] | | 账户创建 | #[light_account(init, ...)]属性或CreateTokenAccountCpi | CreateTokenAccountCpi,CreateMints批量模式 | | 压缩/解压缩处理器 | 由#[lightprogram]宏自动生成 | 在入口点路由ProgramAccounts::COMPRESSACCOUNTS_IDEMPOTENT等 | | 程序ID常量 | 不需要(宏自动派生) | pub const ID: Pubkey = pubkeyarray!(...) + 需要LIGHTCPI_SIGNER | | 依赖项 | light-sdk,light-sdk-macros,light-token,light-anchor-spl | light-account-pinocchio,light-token-pinocchio,bytemuck |

DeFi集成

对于DeFi程序(AMM、借贷、金库):上述Anchor和Pinocchio模式直接适用。DeFi特定参考资料:

任务参考资料
路由器/聚合器集成(冷账户加载)references/router.md
LightProgramInterface特性(用于路由器的客户端SDK)
references/client-sdk.md |

热模型与冷模型

经过长时间不活动(多个纪元无写入)后,账户自动压缩为冷状态。程序仅与热账户交互。客户端通过createloadinstructions将冷账户重新加载到链上。

热(活跃)冷(不活跃)
存储链上压缩
延迟
正常 | +0-200ms |
| 交易大小 | 正常 | +100-2400字节 |
| CU | 正常 | +15k-400k CU |
| 程序代码 | 无变化 | 无变化 |

热路径具有零开销。

外部参考资料

资源链接
Anchor AMM参考cp-swap-reference
Pinocchio交换参考
pinocchio-swap | | Anchor计数器(免租金PDA) | basic-macros/counter | | Pinocchio计数器(零拷贝PDA) | pinocchio/counter |

SDK参考资料

链接
light-sdkdocs.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 |

安全性

本技能不拉取、存储或传输外部机密。仅提供代码模式、文档参考和开发指导。

  • - 不消耗凭证。 本技能不需要API密钥、私钥或签名密钥。显式声明了env: []。
  • 用户提供的配置。 RPC端点、钱包密钥对和身份验证令牌(Privy、钱包适配器)在用户自己的应用程序代码中配置——本技能仅演示如何使用它们。
  • 安装来源。 npx skills add Lightprotocol/skills从公共GitHub仓库(Lightprotocol/skills)安装。运行前请验证来源。
  • 子代理范围。 本技能可能生成只读子代理,使用Read、Glob和Grep搜索本地仓库。请将工作目录限制在您的项目中。
  • 经过审计的协议。 Light Protocol智能合约经过独立审计。审计报告发布在github.com/Lightprotocol/light-protocol/tree/main/audits

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 solana-light-sdk-1776301583 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 solana-light-sdk-1776301583 技能

通过命令行安装

skillhub install solana-light-sdk-1776301583

下载

⬇ 下载 light-sdk v1.0.1(免费)

文件大小: 19.41 KB | 发布时间: 2026-4-16 17:57

v1.0.1 最新 2026-4-16 17:57
- Added a rent cost comparison table to highlight how Light SDK drastically reduces rent for token accounts and DeFi pools compared to Solana/SPL.
- Updated introductory explanation to include new rent-exemption details and cost example.
- No code logic or workflow changes; documentation improvement only.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部