Solana Token Vesting: Complete Step by Step Guide.

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.

First, Get Your Setup Right - No Skipping This

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.

  • Solana CLI for everything: accounts, tokens, programs.
  • SPL Token CLI - run cargo install spl token cli for token minting.
  • Phantom or Solflare wallet - but CLI is faster for this.
  • Node access - use devnet first. Grab free SOL from faucet.solana.com. Fees? Like 0.000005 SOL per tx. Pennies.

And fund your wallets. I usually make two keypairs: one for holding tokens (source), one for receiving (dest). Run this:

  1. solana keygen new --outfile ~/wallet/source.json
  2. solana keygen new --outfile ~/wallet/dest.json
  3. solana config set --url https://api.devnet.solana.com
  4. Airdrop: solana airdrop 2 ~/wallet/source.json --url devnet (repeat for dest).

Test it. solana balance. Got SOL? Good. Now tokens.

Minting Your SPL Token - Quick and Dirty

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.

Bonfida Vesting - The Easiest Program Out There

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.

Creating Your First Vesting Schedule

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.

Common Screw Ups and Fixes

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.

Releasing Tokens - The Unlock Dance

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.

No Code Options - Because CLI Sucks Sometimes

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.

MethodProsConsFee
CLI BonfidaFree (own deploy), flexible schedulesCommand line hell0.000005 SOL/tx
UI like StreamflowEasy, visual calendarSmall service fee0.01 SOL
Custom Rust/AnchorTotal controlCode it yourselfDeploy 0.1 SOL

Pick based on vibe. I usually CLI for small stuff, UI for teams.

Tricky Schedules - Cliffs, Linear, Steps

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.

Custom Program? If You're Feeling Fancy

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.

Real World Gotchas - Don't Learn Hard Way

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.

Pro Tips from My Mess Ups

  • Devnet always first. Mainnet no take backs.
  • Slots calc: Use solana epoch info, slots ~2/day * 400ms. Tools online convert unix to slot.
  • Bulk vesting: Loop CLI in bash script. Or pay for dashboard.
  • Team multi sig? Use squad.squads.so for admin signs.
  • Gas? Solana priority fees now: --compute unit price 1000 micro lamports for fast.

Scale it. Airdrops with vesting? Mix with bulk senders. Projects grow users this way.

Wrapping One Vesting - From Scratch to Release

  1. Mint token, fund accounts.
  2. Deploy Bonfida or use theirs: VestingPgm4sf3bH3tB6v6rZ1K6Q5P2q3q3q3q3q3q3q3q3q3q (fake, get real).
  3. Create instance with schedule.
  4. Wait slots, unlock.
  5. Done. Tokens flow.

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.