airdrop-protocol
v0.3.2
Published
Solana airdrop CLI: snapshot SPL holders, build merkle trees, deploy distributors.
Maintainers
Readme
airdrop-protocol (CLI)
Command-line tool for running a Solana SPL / Token-2022 airdrop end-to-end: snapshot holders, weight allocations, build a Jupiter-compatible merkle tree, verify proofs.
Part of the airdrop-protocol
toolkit. See the repo for the SDK (@airdropprotocol/sdk) and the React
widget (@airdropprotocol/widget).
Install
# global
npm install -g airdrop-protocol
# or one-shot
npx airdrop-protocol --helpEnvironment
All commands that touch the chain accept --rpc. If not passed, the CLI
reads SOLANA_RPC_URL or HELIUS_RPC_URL from the environment.
export SOLANA_RPC_URL="https://your-rpc-provider/…"The CLI never reads or writes a private key. If a command needs one, it's the wrong CLI.
Commands
| Command | What it does |
|---|---|
| airdrop snapshot | Fetch every SPL holder of a mint, write holders.csv |
| airdrop weight | Apply a weighting strategy (linear / sqrt / tiered / uniform) |
| airdrop tree | Build a Jupiter-compatible merkle tree → proofs.json + root.txt |
| airdrop stats | Summary of a proofs file (root, claimants, totals) |
| airdrop verify | Verify an owner's proof against the recorded root (local, no chain) |
| airdrop format | Minify / pretty-print proofs.json for hosting |
End-to-end example
# 1. snapshot every holder of a source mint
airdrop snapshot \
--mint 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU \
--exclude-cex \
-o holders.csv
# 2. weight the holders (sqrt = anti-whale)
airdrop weight \
--input holders.csv \
--mode sqrt \
--total 1000000000000 \
--output allocations.csv
# 3. build a merkle tree for YOUR airdrop mint
airdrop tree \
--input allocations.csv \
--mint <YOUR_AIRDROP_MINT> \
--decimals 6
# 4. sanity check
airdrop stats -i proofs.json
airdrop verify -i proofs.json --owner <SAMPLE_WALLET>
# 5. deploy a Jupiter merkle-distributor with root.txt
# (lock.jup.ag UI works today; `airdrop deploy` lands in v0.4)
# 6. host proofs.json on any static CDN, ship the claim pageLeaf format
Leaves are:
keccak256( index_le_u64 || owner_pubkey_32 || amount_le_u64 )Matches the Jupiter merkle-distributor
convention exactly — so proofs produced here verify against any Jupiter
distributor without modification. Full details in
docs/tree-format.md.
Exit codes
0success1user error (missing flag, bad file, no RPC configured)2network / RPC error3on-chain / verification mismatch (verifycommand only)
Full reference
See docs/cli.md
for every flag on every command and common pipelines.
License
MIT — see LICENSE.
