Nirvana is a specialized Solana program designed for Equity-Streaming, a hybrid distribution model that synchronizes continuous linear token unlocks with event-driven performance milestones.
This project solves the "Gamble vs. Cashflow" dilemma for Web3 contributors by providing guaranteed liquidity (Base Layer) alongside performance-based rewards (Milestone Layer).
Before setting up, ensure you have the following installed:
- Rust:
rustc 1.75.0or later - Solana CLI:
solana-cli 3.1.0or later (Agave) - Anchor CLI:
anchor-cli 1.0.0 - Node.js:
v18.18.0or later - NPM
Clone the repository and install dependencies:
git clone https://github.com/rikokurnia/nirvana-infinity.git
cd nirvana-infinity
npm installTo compile the smart contract and generate the IDL:
anchor buildThis generates target/deploy/nirvana.so and target/idl/nirvana_protocol.json. The repo keypair matches the devnet program ID (DygVVP...); use anchor build --ignore-keys only if your local keypair differs.
Option A: Test script (recommended)
chmod +x run-tests.sh
./run-tests.shThe script starts a local validator, loads the program at the declared devnet ID via --bpf-program, and runs the full Mocha suite (40 tests, ~3 minutes).
Option B: Manual
# Terminal 1
solana-test-validator --reset \
--bpf-program DygVVPMyA2WnbfJiqta38ySR3YhnKbqbFcNzcsjkti4K \
target/deploy/nirvana.so
# Terminal 2
ANCHOR_WALLET=~/.config/solana/id.json \
ANCHOR_PROVIDER_URL=http://localhost:8899 \
NODE_OPTIONS="--no-experimental-strip-types" \
npm testNote: The test suite covers stream creation, cliff/milestone vesting, cancel splits, arbiter triggers, and top_up.
Detailed documentation for developers and integrators can be found in the docs/ directory:
- Instruction Reference: Detailed breakdown of every smart contract instruction (parameters, behavior, and error codes).
- Integration Guide: Step-by-step guide with TypeScript snippets for creating and interacting with streams.
- Testing & CI Guide: Build,
run-tests.sh, CI pipeline, and test suite structure. - Architecture Decision Records (ADR): Key design decisions (e.g., Nonce-seeded PDAs, Vault Auto-close, local test harness).
Frontend: https://nirvana-infinity.vercel.app
Program ID (Devnet): DygVVPMyA2WnbfJiqta38ySR3YhnKbqbFcNzcsjkti4K
The program implements the following Equity-Streaming architecture:
| Instruction | Description |
|---|---|
create_stream |
Initializes vesting state, transfers tokens to PDA vault |
withdraw |
Claims matured tokens (linear + milestone) |
cancel |
Terminates stream, pays recipient unlocked portion, refunds creator |
trigger_milestone |
Flips milestone_achieved flag (oracle/admin only) |
top_up |
Adds tokens and/or extends end time on a live stream |
release_vault |
Cleans up orphaned vaults from pre-cancel-upgrade streams |
solana config set --url devnet --keypair ~/.config/solana/id.jsonsolana airdrop 2anchor program deploy --provider.cluster devnetOr manually:
solana program deploy target/deploy/nirvana.so --program-id target/deploy/nirvana-keypair.jsonThis repository is equipped with GitHub Actions. Every push or pull request triggers a workflow that:
- Sets up Solana 3.1 + Anchor 1.0.
- Runs
anchor build --ignore-keysand verifies build artifacts. - Executes
./run-tests.sh(40 integration tests).
The frontend/ directory contains the Next.js 15 App Router UI.
- Wallet connection — Privy embedded wallet + Phantom/Solflare via Solana Wallet Standard
- Founder dashboard — create streams (multi-recipient, token select, preset splits, optional cliff), view/cancel active streams, transaction history
- Worker dashboard — list incoming streams, dual-layer progress bars (linear + milestone), one-click withdraw
- mUSDC faucet — in-app button mints devnet mock USDC to the connected wallet (server-side, keypair never exposed)
- Loading states — every transaction shows wallet approval → sending → confirming feedback
- Error messages — on-chain errors decoded and shown inline
- Nonce-seeded PDAs — same founder → recipient pair can have unlimited concurrent/sequential streams (no collision)
cd frontend
cp .env.example .env.local # fill in NEXT_PUBLIC_PRIVY_APP_ID, NEXT_PUBLIC_MOCK_USDC_MINT, MOCK_USDC_FAUCET_SECRET
npm install
npm run devOpen http://localhost:3000.
- Sora Onchain (@SoraOnchain): Lead Architect. Smart contract design, account struct definitions, all on-chain instructions, CI pipeline.
- Riko Kurnia (@rikokurnia): Frontend Integration. Full Next.js UI (dashboard, create/cancel/withdraw flows, faucet, history), Anchor integration layer (
lib/anchor.ts), nonce-seeded PDA fix, devnet deployment.
MIT License. Created for Mancer Season 1.

