Airdrop
Distribute compressed tokens to multiple recipients using TypeScript client.
Disclaimer: This guide demonstrates efficient token distribution on Solana using ZK compression. It does not constitute financial advice and does not endorse any specific token or project.
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
- Match task to
distribution approaches below
- Locate relevant documentation and examples
- 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: 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.
Distribution via Client
| Scale | Approach |
|---|
| <10,000 recipients | Single transaction - see simple-airdrop.md |
| 10,000+ recipients |
Batched with retry - see
batched-airdrop.md |
| No-code |
Airship by Helius (up to 200k) |
Cost Comparison
| Creation | Solana | Compressed |
|---|
| Token Account | ~2,000,000 lamports | 5,000 lamports |
Claim Program Reference Implementations
Customize token distribution and let users claim.
Simple Implementation: simple-claim - Distributes compressed tokens that get decompressed on claim.
Advanced Implementation: distributor - Distributes SPL tokens, uses compressed PDAs to track claims. Based on jito Merkle distributor.
| distributor | simple-claim |
|---|
| Vesting | Linear Vesting | Cliff at Slot X |
| Partial claims |
Yes | No |
| Clawback | Yes | No |
| Frontend | REST API + CLI | None |
The programs are reference implementations and not audited. The Light Protocol Programs are audited and live on Solana Mainnet.
Cost
| Per-claim | 100k claims |
|---|
| simple-claim | ~0.00001 SOL | ~1 SOL |
| distributor (compressed) |
~0.00005 SOL | ~5 SOL |
| distributor (original) | ~0.002 SOL | ~200 SOL |
Core Pattern
CODEBLOCK0
Setup: Create Mint
CODEBLOCK1
Compute Units
| Recipients/instruction | CU |
|---|
| 1 | 120,000 |
| 5 |
170,000 |
| Batched tx | 500,000 |
Lookup Tables
Reduce transaction size:
| Network | Address |
|---|
| Mainnet | INLINECODE9 |
| Devnet |
qAJZMgnQJ8G6vA3WRcjD9Jan1wtKkaCFWLWskxJrR5V |
Advanced: Claim-Based
For vesting, clawback, or user-initiated claims:
Cliff vesting at slot X |
Resources
SDK references
| Package | Link |
|---|
| INLINECODE11 | API docs |
| INLINECODE12 |
API docs |
Security
This skill provides code patterns and documentation references only.
- - Declared dependencies. Reference examples require
HELIUS_API_KEY (RPC provider key) and a payer keypair for signing transactions. Neither is needed for read-only or localnet testing. In production, load both from a secrets manager — never hard-code private keys. - Filesystem scope.
Read, Glob, and Grep must be limited to the current project directory and skill references. Do not read outside these paths. - Subagent scope. When stuck, the skill asks to spawn a read-only subagent with
Read, Glob, Grep scoped to skill references, example repos, and docs. - Install source.
npx skills add Lightprotocol/skills from Lightprotocol/skills. - Audited protocol. Light Protocol smart contracts are independently audited. Reports are published at github.com/Lightprotocol/light-protocol/tree/main/audits.
空投
使用 TypeScript 客户端向多个接收者分发压缩代币。
免责声明: 本指南演示了使用 ZK 压缩在 Solana 上进行高效代币分发。这不构成财务建议,也不认可任何特定代币或项目。
工作流程
- 1. 明确意图
- 如果未激活,建议使用计划模式
- 使用 AskUserQuestion 解决盲点
- 执行前必须解决所有问题
- 2. 识别参考资料和技能
- 将任务匹配到下方的
分发方法
- 定位相关文档和示例
- 3. 编写计划文件(YAML 任务格式)
- 对任何不清楚的内容使用 AskUserQuestion — 切勿猜测或假设
- 识别阻塞因素:权限、依赖项、未知项
- 执行开始前计划必须完整
- 4. 执行
- 使用 Task 工具配合子代理进行并行研究
- 子代理通过 Skill 工具加载技能
- 使用 TodoWrite 跟踪进度
- 5. 遇到困难时:请求生成一个只读子代理,具有 Read、Glob、Grep 和 DeepWiki MCP 访问权限,加载 skills/ask-mcp。读取范围限定在技能参考资料、示例仓库和文档。
通过客户端分发
带重试的批量处理 - 参见
batched-airdrop.md |
| 无需编码 |
Helius 的 Airship(最多 20 万) |
成本对比
| 创建 | Solana | 压缩 |
|---|
| 代币账户 | ~2,000,000 lamports | 5,000 lamports |
领取程序参考实现
自定义代币分发并允许用户领取。
简单实现:simple-claim - 分发压缩代币,领取时解压缩。
高级实现:distributor - 分发 SPL 代币,使用压缩 PDA 跟踪领取。基于 jito Merkle 分发器。
| distributor | simple-claim |
|---|
| 归属 | 线性归属 | 在插槽 X 处悬崖归属 |
| 部分领取 |
是 | 否 |
| 收回 | 是 | 否 |
| 前端 | REST API + CLI | 无 |
这些程序是参考实现,未经审计。Light Protocol 程序已经过审计,并在 Solana 主网上运行。
成本
| 每次领取 | 10 万次领取 |
|---|
| simple-claim | ~0.00001 SOL | ~1 SOL |
| distributor(压缩) |
~0.00005 SOL | ~5 SOL |
| distributor(原始) | ~0.002 SOL | ~200 SOL |
核心模式
typescript
import { CompressedTokenProgram, getTokenPoolInfos, selectTokenPoolInfo } from @lightprotocol/compressed-token;
import { bn, createRpc, selectStateTreeInfo, buildAndSignTx, sendAndConfirmTx } from @lightprotocol/stateless.js;
import { ComputeBudgetProgram } from @solana/web3.js;
const rpc = createRpc(RPC_ENDPOINT);
// 1. 获取基础设施
const treeInfo = selectStateTreeInfo(await rpc.getStateTreeInfos());
const tokenPoolInfo = selectTokenPoolInfo(await getTokenPoolInfos(rpc, mint));
// 2. 构建压缩指令(SPL → 压缩到多个接收者)
const ix = await CompressedTokenProgram.compress({
payer: payer.publicKey,
owner: payer.publicKey,
source: sourceAta.address, // 持有代币的 SPL 关联代币账户
toAddress: recipients, // PublicKey[]
amount: recipients.map(() => bn(amount)),
mint,
tokenPoolInfo,
outputStateTreeInfo: treeInfo,
});
// 3. 使用计算预算发送(每个接收者 12 万 CU)
const instructions = [
ComputeBudgetProgram.setComputeUnitLimit({ units: 120_000 * recipients.length }),
ix,
];
const { blockhash } = await rpc.getLatestBlockhash();
const tx = buildAndSignTx(instructions, payer, blockhash, []);
await sendAndConfirmTx(rpc, tx);
设置:创建铸币
typescript
import { createMint } from @lightprotocol/compressed-token;
import { getOrCreateAssociatedTokenAccount, mintTo } from @solana/spl-token;
const { mint } = await createMint(rpc, payer, payer.publicKey, 9);
const ata = await getOrCreateAssociatedTokenAccount(rpc, payer, mint, payer.publicKey);
await mintTo(rpc, payer, mint, ata.address, payer.publicKey, 100000000_000);
计算单元
170,000 |
| 批量交易 | 500,000 |
查找表
减少交易大小:
| 网络 | 地址 |
|---|
| 主网 | 9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ |
| 开发网 |
qAJZMgnQJ8G6vA3WRcjD9Jan1wtKkaCFWLWskxJrR5V |
高级:基于领取
用于归属、收回或用户发起的领取:
在插槽 X 处悬崖归属 |
资源
SDK 参考
| 包 | 链接 |
|---|
| @lightprotocol/stateless.js | API 文档 |
| @lightprotocol/compressed-token |
API 文档 |
安全性
本技能仅提供代码模式和文档参考。
- - 声明的依赖项。 参考示例需要 HELIUSAPIKEY(RPC 提供者密钥)和用于签署交易的付款人密钥对。只读或本地网络测试不需要这两者。在生产环境中,从密钥管理器加载两者 — 切勿硬编码私钥。
- 文件系统范围。 Read、Glob 和 Grep 必须限制在当前项目目录和技能参考资料内。不要读取这些路径之外的内容。
- 子代理范围。 遇到困难时,技能会请求生成一个只读子代理,Read、Glob、Grep 限定在技能参考资料、示例仓库和文档范围内。
- 安装源。 npx skills add Lightprotocol/skills 来自 Lightprotocol/skills。
- 经过审计的协议。 Light Protocol 智能合约经过独立审计。报告发布在 github.com/Lightprotocol/light-protocol/tree/main/audits。