Full lesson
stave
Solana marketplace for intellectual property rights
What it does
From the project README:
1. **Open the Stave program on Solana Explorer (devnet).** Confirm the program account exists, owned by BPF Loader, with ~430KB of Rust deployed. 2. **Open the `create_work` transaction.** The first Stave catalog (Suliko) was minted on-chain by this real TX, with a Token-2022 share supply created and listed. 3. **Open the live URL**, connect Phantom on devnet, browse to a catalog, click Buy. Real wallet. Real signature. Real devnet TX.
- Original
- levanglij/stave
- SuperStack fork
- Blockchains/stave @
0ffe21b - Stars
- 0
- Last push (original)
- 2026-05-10
- Languages
- TypeScript, Python, Rust, CSS, JavaScript
- Detected stack
- AnchorNext.jsweb3.js
- Categories
- Other
- Licence
- MIT
- Homepage
- https://stave-five.vercel.app
Architecture
91 source files. By extension: .tsx ×42, .py ×18, .ts ×17, .rs ×14.
| Top-level directory | Source files |
|---|---|
web | 55 |
engine | 18 |
program | 18 |
On-chain programs: program/programs/stave
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/stave/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
program/programs/stave/src/instructions/deposit_royalty.rs L13–36 @ 0ffe21b · MIT · original/// Deposit `amount` of `payment_mint` into a work's royalty vault.////// Anyone can call: artist, label, distributor, fan. The vault is/// initialized lazily on the first deposit and becomes the holding/// account for that work's royalties forever after.////// Once tokens are in the vault, holders draw against them pro-rata/// via `claim_royalty`.#[derive(Accounts)]#[instruction(amount: u64)]pub struct DepositRoyalty<'info> { #[account(mut)] pub depositor: Signer<'info>, /// The work receiving the royalty. Read-only. pub ip_work: Box<Account<'info, IpWork>>, /// Royalty vault PDA. Initialized on first deposit. #[account( init_if_needed, payer = depositor, space = 8 + RoyaltyVault::INIT_SPACE, seeds = [ROYALTY_SEED, ip_work.key().as_ref()], bump,- Line 25
pub depositor: Signer<'info>,: Requires this account to have signed the transaction. - Line 32
init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs. - Line 35
seeds = [ROYALTY_SEED, ip_work.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 36
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
program/programs/stave/src/instructions/buy_shares.rs L25–48 @ 0ffe21b · MIT · original #[account(mut)] pub buyer: Signer<'info>, /// The work's creator - payment recipient. Verified by IpWork's /// has_one constraint below. /// CHECK: only used to derive creator_payment_ata; address is /// validated by `has_one = creator` on ip_work. pub creator: SystemAccount<'info>, #[account( has_one = creator @ StaveError::NotWorkCreator, has_one = share_mint @ StaveError::ShareMintMismatch, )] pub ip_work: Box<Account<'info, IpWork>>, /// Listing PDA - verified via [b"listing", ip_work] seeds. /// has_one ensures the passed payment_mint and vault match. #[account( mut, seeds = [LISTING_SEED, ip_work.key().as_ref()], bump = listing.bump, has_one = payment_mint @ StaveError::PaymentMintMismatch, has_one = vault @ StaveError::VaultMismatch, )]- Line 26
pub buyer: Signer<'info>,: Requires this account to have signed the transaction. - Line 29
/// has_one constraint below.: Checks that a stored pubkey field matches the passed account. - Line 44
seeds = [LISTING_SEED, ip_work.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 45
bump = listing.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
program/programs/stave/src/instructions/claim_royalty.rs L25–48 @ 0ffe21b · MIT · originalpub struct ClaimRoyalty<'info> { #[account(mut)] pub holder: Signer<'info>, pub ip_work: Box<Account<'info, IpWork>>, /// Used to validate `holder_share_ata`'s mint. pub share_mint: Box<InterfaceAccount<'info, Mint>>, /// Holder's share ATA. Balance at claim time determines the share. #[account( associated_token::mint = share_mint, associated_token::authority = holder, associated_token::token_program = share_token_program, )] pub holder_share_ata: Box<InterfaceAccount<'info, TokenAccount>>, #[account( mut, seeds = [ROYALTY_SEED, ip_work.key().as_ref()], bump = royalty_vault.bump, has_one = payment_mint @ StaveError::PaymentMintMismatch, )] pub royalty_vault: Box<Account<'info, RoyaltyVault>>,- Line 27
pub holder: Signer<'info>,: Requires this account to have signed the transaction. - Line 44
seeds = [ROYALTY_SEED, ip_work.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 45
bump = royalty_vault.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 46
has_one = payment_mint @ StaveError::PaymentMintMismatch,: Checks that a stored pubkey field matches the passed account.
program/programs/stave/src/instructions/create_work.rs L13–36 @ 0ffe21b · MIT · original/// - Creates a Token-2022 share mint with the PDA as mint authority/// - Mints the full `total_shares` supply to the creator's ATA////// The Metaplex Core NFT mint is intentionally deferred to a follow-up/// instruction; `core_nft` is left as `Pubkey::default()` on creation.#[derive(Accounts)]#[instruction(work_id: u64, metadata_uri: String, total_shares: u64)]pub struct CreateWork<'info> { #[account(mut)] pub creator: Signer<'info>, #[account( init, payer = creator, space = 8 + IpWork::INIT_SPACE, seeds = [IP_WORK_SEED, creator.key().as_ref(), &work_id.to_le_bytes()], bump, )] pub ip_work: Account<'info, IpWork>, #[account( init, payer = creator, mint::decimals = 0,- Line 22
pub creator: Signer<'info>,: Requires this account to have signed the transaction. - Line 25
init,: Creates and pays for a new account. Space and payer must be specified. - Line 28
seeds = [IP_WORK_SEED, creator.key().as_ref(), &work_id.to_le_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 29
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
web | npm run dev | next dev |
web | npm run start | next start |
web | npm run build | next build |
web | npm run lint | next lint |
program | npm run test | anchor test |
program | anchor build | compile programs and generate IDLs |
program | anchor test | local validator + test suite |
program | anchor run test | pnpm exec ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)