Okay, picture this: your buddy just launched a Solana token, everyone's hyped, but the big investors are like "nah, we need vesting so you don't rug us day one." Sound familiar? That's exactly what happened to me last month. I had to figure out Solana token vesting from scratch - minting, locking, scheduling releases. Took a weekend, but now it's smooth. So here's the real deal, step by step, like I'm walking you through it over Discord.
Why does this matter? Vesting stops dumps that tank the price. Team gets tokens over time, investors chill, project lives longer. In my experience, projects without it die fast. Pretty much every Solana launch uses it now.
Look, before touching vesting, you need tools. Solana CLI is king here. Download it from their site, install with whatever your OS needs - brew on Mac, apt on Linux. Super quick.
cargo install spl token cli for token minting.And fund your wallets. I usually make two keypairs: one for holding tokens (source), one for receiving (dest). Run this:
solana keygen new --outfile ~/wallet/source.jsonsolana keygen new --outfile ~/wallet/dest.jsonsolana config set --url https://api.devnet.solana.comsolana airdrop 2 ~/wallet/source.json --url devnet (repeat for dest).Test it. solana balance. Got SOL? Good. Now tokens.
Tokens on Solana are SPL. Don't overthink. Create mint:
spl token create token That spits out a mint address, like TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA. Copy it. Decimals? Usually 9, like USDC.
Then derive accounts:
spl token create account MINT_ADDRESS --owner ~/wallet/source.json
spl token create account MINT_ADDRESS --owner ~/wallet/dest.json Mint 1000 tokens to source (adjust for decimals):
spl token mint MINTADDRESS 1000 --decimals 9 --owner ~/wallet/source.json Check: spl token balance MINTADDRESS. Source has 1000, dest has 0. Perfect. You're ready to vest.
Okay, now the fun part. Solana doesn't have built in vesting like Eth's Timelock. You deploy a program. Bonfida's is audited, battle tested. Most projects use it. Thing is, you don't always deploy yourself - grab their mainnet address. But for learning? Deploy it.
Clone the repo: git clone https://github.com/Bonfida/token vesting.git. Cd into it. Build with Cargo: cargo build bpf. Deploy:
solana program deploy target/deploy/tokenvesting.so --url devnet Costs ~0.1 SOL. Grabs a PROGRAMADDRESS. Save it. In my experience, devnet deploys fly, mainnet needs more SOL.
Now build CLI tools: cd cli, cargo build. This lets you create vesting instances.
Here's where it clicks. You create a "vesting instance" - basically a contract for specific tokens, schedule, recipient.
Basic one: discrete releases. Say, release 250 tokens at slot times matching dates. Slots? Solana blocks, ~0.4s each. Calc with solana slot --url devnet or explorers.
Run this monster (replace vars):
./target/debug/tokenvestingcli create \ --url https://api.devnet.solana.com \ --mint MINTADDRESS \ --source SOURCETOKENACCOUNT \ --destination DESTTOKENACCOUNT \ --amounts 250,250,250,250 \ --releaseslot 300000000,310000000,320000000,330000000 \ --payer ~/wallet/source.json Breaks down: amounts comma separated, releaseslot too. Payer covers ~0.000005 SOL fee. Signs with source owner.
It creates a vesting account (seed). Outputs CONTRACTSEED. Anyone can check it later.
Linear vesting? Easier for ongoing. Add --linear flag, --end_slot 400000000 or whatever future slot.
First time I did this? Wrong decimals. Minted 1000 but meant 1000 * 10^9. Fix: always --decimals 9 flag.
No tokens move? Check if slot passed. Use ./target/debug/tokenvestingcli info --seed CONTRACT_SEED --url devnet. Shows remaining, next release.
Destination account missing? CLI auto creates ATA (associated token account) if you use pubkey, not ATA.
Tokens don't auto unlock. Call "unlock" or "crank". Anyone can, but usually recipient.
./target/debug/tokenvestingcli unlock --seed CONTRACTSEED --url devnet --payer ~/wallet/dest.json Transfers vested amount to dest. Boom. Check balance.
Change dest mid vest? If you're current dest signer:
./target/debug/tokenvestingcli change destination --seed CONTRACTSEED --new destination NEW_PUBKEY --url devnet Handy if wallet changes. Fees same tiny amount.
Okay, honest talk: CLI is powerful but clunky. Lazy mode? UIs.
Streamflow or Saber have dashboards. Connect Phantom, pick token, set cliff (e.g. 1 year no release), duration (4 years linear), amount. Pays ~0.01 SOL total. They use Bonfida under hood.
Bitbond like tools too, but Solana specific: check SolanaFM or explorers for vesting creators. Upload CSV for bulk - investor lists, etc.
| Method | Pros | Cons | Fee |
|---|---|---|---|
| CLI Bonfida | Free (own deploy), flexible schedules | Command line hell | 0.000005 SOL/tx |
| UI like Streamflow | Easy, visual calendar | Small service fee | 0.01 SOL |
| Custom Rust/Anchor | Total control | Code it yourself | Deploy 0.1 SOL |
Pick based on vibe. I usually CLI for small stuff, UI for teams.
Cliff? First chunk waits. E.g. team: 1 year cliff, then monthly. In Bonfida, set first releaseslot far out, then frequent.
Linear: --linear --startslot NOW --end_slot 1YEARLATER. Calculates even release per slot. Why slots not dates? Slots precise, time drifts tiny.
Steps: Multiple discrete. Investor example: 25% at TGE (token gen event, slot 0), 25% quarterly. Comma list amounts/slots.
What's next for bulk? CSV into UI, or script CLI loops. I scripted Python wrapper once - saved hours.
Bonfida good enough 90% time. But want own? Anchor framework. Rust crate.
Init: anchor init vesting. Define accounts: escrow, beneficiaries vec, percentavailable.
Functions: initialize (set bennies, amount), release (admin sets % unlocked), claim (bennies pull).
Code snippet like:
pub fn claim(ctx: Context<Claim>, databump: u8) -> Result<()> { // calc vested = (percent / 100) * alloc // transfer from escrow to benny // update claimed
} Deploy via anchor deploy. Test with mocha. Mainnet? Audit first, exploits kill projects.
In my experience, stick to Bonfida unless weird needs. Theirs handles crank, changes fine.
Fees add up on mainnet. 10 vests? 0.05 SOL. Not bad.
Token immutable? Revoke mint authority post vest setup: spl token authorize MINT mint --disable. Can't inflate.
Tax tokens? Some have transfer fees. Vesting accounts need to handle - Bonfida does.
Mainnet switch: Change --url https://api.mainnet beta.solana.com. Fund real SOL. Use Helius or Quicknode RPC for speed, free tiers rock.
Monitor: Solscan.io, search vesting account. Public, transparent. Investors love that.
Scale it. Airdrops with vesting? Mix with bulk senders. Projects grow users this way.
That's it. Did one for a meme coin last week - held price like champ. Try devnet now, ping if stuck. You'll nail it.