← 返回
AI智能 Key 中文

solana-token-distribution

For token distribution on Solana 5000x cheaper than SPL (rewards, airdrops, depins, ...). @lightprotocol/compressed-token (TypeScript). Reference examples fo...
Solana代币分发比SPL便宜5000倍,用于奖励、空投等场景。@lightprotocol/compressed-token (TypeScript)。参考示例...
tilo-14
AI智能 clawhub v1.0.1 1 版本 99865.8 Key: 需要
★ 0
Stars
📥 744
下载
💾 19
安装
1
版本
#latest

概述

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
  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

ScaleApproach
-----------------
<10,000 recipientsSingle transaction - see simple-airdrop.md
10,000+ recipientsBatched with retry - see batched-airdrop.md
No-codeAirship by Helius (up to 200k)

Cost Comparison

CreationSolanaCompressed
:----------------:------------------:-----------------
Token Account~2,000,000 lamports5,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.

distributorsimple-claim
-----------------------------
VestingLinear VestingCliff at Slot X
Partial claimsYesNo
ClawbackYesNo
FrontendREST API + CLINone

The programs are reference implementations and not audited. The Light Protocol Programs are audited and live on Solana Mainnet.

Cost

Per-claim100k claims
---------------------------------------:------------:
simple-claim~0.00001 SOL~1 SOL
distributor (compressed)~0.00005 SOL~5 SOL
distributor (original)~0.002 SOL~200 SOL

Core Pattern

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. Get infrastructure
const treeInfo = selectStateTreeInfo(await rpc.getStateTreeInfos());
const tokenPoolInfo = selectTokenPoolInfo(await getTokenPoolInfos(rpc, mint));

// 2. Build compress instruction (SPL → compressed to multiple recipients)
const ix = await CompressedTokenProgram.compress({
  payer: payer.publicKey,
  owner: payer.publicKey,
  source: sourceAta.address,           // SPL associated token account holding tokens
  toAddress: recipients,                // PublicKey[]
  amount: recipients.map(() => bn(amount)),
  mint,
  tokenPoolInfo,
  outputStateTreeInfo: treeInfo,
});

// 3. Send with compute budget (120k CU per recipient)
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);

Setup: Create Mint

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, 100_000_000_000);

Compute Units

Recipients/instructionCU
---------------------------
1120,000
5170,000
Batched tx500,000

Lookup Tables

Reduce transaction size:

NetworkAddress
------------------
Mainnet9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ
DevnetqAJZMgnQJ8G6vA3WRcjD9Jan1wtKkaCFWLWskxJrR5V

Advanced: Claim-Based

For vesting, clawback, or user-initiated claims:

ImplementationFeatures
-------------------------
Merkle DistributorLinear vesting, partial claims, clawback, REST API
Simple ClaimCliff vesting at slot X

Resources

SDK references

PackageLink
---------------
@lightprotocol/stateless.jsAPI docs
@lightprotocol/compressed-tokenAPI 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.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 23:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,055 📥 795,887
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 709 📥 243,527
developer-tools

solana-light-token-client

tilo-14
针对Solana代币客户端开发,Light Token比SPL便宜200倍且改动极小。技能涵盖创建铸造及关联账户指南……
★ 0 📥 881