🤖 Barbrick Design - Web Projects Hub

Home About Monetization GitHub
← Back to Home

RootIB: RB-20260314003056-C9D0E1F2

Solana-Gated Random Number Generator

A Next.js app that gates access behind a Solana payment using the pump.fun tokenized agent protocol.

How it Works

  1. User connects their Solana wallet (Phantom or Solflare)
  2. User clicks Pay 0.1 SOL & Generate
  3. The server builds an invoice transaction via @pump-fun/agent-payments-sdk
  4. The user signs the transaction in their wallet
  5. The server verifies the on-chain payment via validateInvoicePayment
  6. A random number between 0 and 1000 is returned

Agent Token

Mint: 28rwY1tifqrrZ22KCVzubqcBRvtqwCLGzHcG8ZxPpump
View on pump.fun: https://pump.fun/coin/28rwY1tifqrrZ22KCVzubqcBRvtqwCLGzHcG8ZxPpump

Quick Start

# 1. Install dependencies
npm install

# 2. Configure environment
cp .env.local.example .env.local
# Edit .env.local with your Solana RPC URL

# 3. Run the development server
npm run dev
# → http://localhost:3001

Environment Variables

Variable Default Description
SOLANA_RPC_URL https://rpc.solanatracker.io/public Server-side Solana RPC
NEXT_PUBLIC_SOLANA_RPC_URL https://rpc.solanatracker.io/public Client-side Solana RPC
AGENT_TOKEN_MINT_ADDRESS 28rwY1...pump pump.fun agent token mint
CURRENCY_MINT So11...12 (wrapped SOL) Payment currency mint
PRICE_AMOUNT 100000000 Price in lamports (0.1 SOL)

API Endpoints

POST /api/create-invoice

Builds an unsigned payment transaction for the user to sign.

Body: { "userWallet": "<base58 public key>" }
Response: { "transaction": "<base64>", "memo": "...", "startTime": "...", "endTime": "...", "amount": "..." }

POST /api/verify-payment

Verifies that the invoice was paid on-chain and returns a random number.

Body: { "userWallet", "memo", "startTime", "endTime", "amount" }
Response: { "success": true, "randomNumber": 742 } or { "success": false, "error": "..." }

Tech Stack

Pump.fun Ecosystem

Follow on Pump! Code: DiamondBoi — https://refer.pump.fun/DiamondBoi
New users: https://join.pump.fun/HSag/ko3gg0x0


© 2008-2026 Barbrick Design BarbrickDesign@gmail.com