Sol.College

Full lesson

Streampay

Privacy-first cross-chain subscriptions on Solana.

What it does

From the project README:

StreamPay isn't just another payment gateway; it's the missing link between the sovereign freedom of decentralized finance and the non-negotiable privacy of global commerce. We've built the infrastructure that finally allows businesses to scale on-chain without stripping away their competitive confidentiality.
Original
rohan911438/Streampay
SuperStack fork
Blockchains/Streampay @ f77924b
Stars
0
Last push (original)
2026-05-02
Languages
TypeScript, HTML, JavaScript, Rust, PowerShell, Batchfile
Detected stack
AnchorNext.jsweb3.js
Categories
PaymentsInfrastructure & Tooling
Licence
MIT
Homepage
https://streampay-web.vercel.app

Architecture

99 source files. By extension: .ts ×60, .js ×19, .tsx ×18, .rs ×2.

Top-level directorySource files
apps76
streampay-sdk8
packages7
scripts5
contracts2
scratch1

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/streampay/. 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.

rohan911438/Streampay · contracts/payment-router/src/lib.rs L49–72 @ f77924b · MIT · original
        require!(            authority == payment_record.user                || authority == payment_record.merchant                || authority.to_bytes() == BACKEND_AUTHORITY_BYTES,            PaymentRouterError::Unauthorized        );         payment_record.execution_reference = execution_reference;        payment_record.status = PaymentStatus::Completed;         Ok(())    }} #[derive(Accounts)]pub struct CreatePayment<'info> {    #[account(mut)]    pub user: Signer<'info>,    #[account(init, payer = user, space = PaymentRecord::SPACE)]    pub payment_record: Account<'info, PaymentRecord>,    pub system_program: Program<'info, System>,} #[derive(Accounts)]
  1. Line 49 require!(: An explicit validation that aborts the instruction with an error.
  2. Line 66 pub user: Signer<'info>,: Requires this account to have signed the transaction.
  3. Line 67 #[account(init, payer = user, space = PaymentRecord::SPACE)]: Creates and pays for a new account. Space and payer must be specified.
rohan911438/Streampay · contracts/subscription-manager/src/lib.rs L37–59 @ f77924b · MIT · original
        require!(            authority == payment.user                || authority == payment.merchant                || authority.to_bytes() == BACKEND_AUTHORITY_BYTES,            SubscriptionError::Unauthorized        );        require!(payment.merchant == plan.merchant, SubscriptionError::InvalidMerchant);        require!(payment.amount >= plan.amount, SubscriptionError::InvalidAmount);        require!(payment.is_confirmed, SubscriptionError::PaymentNotConfirmed);        require!(payment.plan_id == plan.plan_id, SubscriptionError::InvalidPlan);         let now = Clock::get()?.unix_timestamp;        let subscription = &mut ctx.accounts.subscription;        subscription.user = payment.user;        subscription.merchant = plan.merchant;        subscription.plan_id = plan.plan_id;        subscription.amount = plan.amount;        subscription.payment_record = payment_record;        subscription.start_timestamp = now;        subscription.end_timestamp = now            .checked_add(plan.duration_seconds)            .ok_or(SubscriptionError::TimestampOverflow)?;        subscription.status = SubscriptionStatus::Active;
  1. Line 37 require!(: An explicit validation that aborts the instruction with an error.
  2. Line 48 let now = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar.
  3. Line 57 .checked_add(plan.duration_seconds): Uses checked arithmetic so overflow fails instead of wrapping.
rohan911438/Streampay · packages/solana/src/payment-router.ts L133–156 @ f77924b · MIT · original
   const transaction = new Transaction().add(instruction);  const signature = await sendAndConfirmTransaction(connection, transaction, [    authority,  ]);   return signature;} /** * Derive the PDA for a payment record */export function derivePaymentRecordPDA(  user: PublicKey,  merchant: PublicKey,  seed: string): PublicKey {  const [pda] = PublicKey.findProgramAddressSync(    [      Buffer.from("payment_record"),      user.toBuffer(),      merchant.toBuffer(),      Buffer.from(seed),    ],
  1. Line 135 const signature = await sendAndConfirmTransaction(connection, transaction, [: Submits the signed transaction to the cluster.
  2. Line 150 const [pda] = PublicKey.findProgramAddressSync(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
rohan911438/Streampay · packages/solana/src/subscription-manager.ts L169–192 @ f77924b · MIT · original
      { pubkey: subscriptionPlanPubkey, isSigner: false, isWritable: false },      { pubkey: paymentRecordPubkey, isSigner: false, isWritable: false },    ],    data: instructionData,  };   const transaction = new Transaction().add(instruction);  const signature = await sendAndConfirmTransaction(connection, transaction, [    authority,  ]);   return signature;} /** * Derive the PDA for a subscription plan */export function deriveSubscriptionPlanPDA(  merchant: PublicKey,  planId: number): PublicKey {  const [pda] = PublicKey.findProgramAddressSync(    [      Buffer.from("subscription_plan"),
  1. Line 176 const signature = await sendAndConfirmTransaction(connection, transaction, [: Submits the signed transaction to the cluster.
  2. Line 190 const [pda] = PublicKey.findProgramAddressSync(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.

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.

DirectoryCommandRuns
.npm run devnpm run --workspace web dev
.npm run startnpm run --workspace web start
.npm run buildnpm run --workspace web build
apps/webnpm run devnext dev -p 3000
apps/webnpm run startnext start
apps/webnpm run buildnext build
streampay-sdknpm run buildtsc
streampay-sdknpm run testjest
streampay-sdknpm run linteslint src --ext .ts

What you could build from it