Full lesson
Driftly
Driftly — Internet Capital Markets Powered by Solana cNFTs
What it does
From the project README:
Build, sell, redeem, and trade digital assets with Solana’s Compressed NFTs (cNFTs). Driftly gives small businesses programmatic loyalty, verifiable discounts, and secondary-market liquidity — at internet scale and near-zero cost (Mint More than 1 Million cNFTs for 0.3 Sol 🤩).
- Original
- Ayushjhax/Driftly
- SuperStack fork
- Blockchains/Driftly @
3ccc785 - Stars
- 0
- Last push (original)
- 2025-10-30
- Languages
- TypeScript, CSS, JavaScript, Shell
- Detected stack
- MetaplexNext.jsSolana Payweb3.js
- Categories
- NFTs & Digital Assets
- Licence
- MIT
- Homepage
- https://monke-driftly.vercel.app/
Architecture
196 source files. By extension: .ts ×142, .tsx ×46, .js ×8.
| Top-level directory | Source files |
|---|---|
frontend | 158 |
api | 16 |
template | 13 |
lib | 6 |
types | 2 |
scripts | 1 |
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/driftly/. 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.
lib/solana-pay-verification.ts L1–24 @ 3ccc785 · MIT · original// Solana Pay-Based Verification System// INNOVATIVE: Use Solana Pay for BOTH payment AND redemption verification! import { Connection, PublicKey, Transaction, Keypair } from '@solana/web3.js';import { createTransferCheckedInstruction, getAssociatedTokenAddress, TOKEN_PROGRAM_ID} from '@solana/spl-token';import { encodeURL, createQR, findReference, validateTransfer } from '@solana/pay';import BigNumber from 'bignumber.js';import QRCode from 'qrcode'; const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'); /** * INNOVATION 1: Discount NFT Verification via Solana Pay * * Instead of traditional QR codes, we use Solana Pay to create a transaction that: * 1. Verifies cNFT ownership (via memo instruction) * 2. Burns a small redemption token (0.000001 SOL) * 3. Records redemption on-chain * * This makes redemption atomic and trustless!- Line 6
createTransferCheckedInstruction,: A checked token transfer, which also verifies the mint and decimals. - Line 10
import { encodeURL, createQR, findReference, validateTransfer } from '@solana/pay';: Encodes a Solana Pay request URL. - Line 10
import { encodeURL, createQR, findReference, validateTransfer } from '@solana/pay';: Finds or validates the on-chain payment by its reference key.
frontend/lib/nft-transfer.ts L1–23 @ 3ccc785 · MIT · originalimport { Connection, PublicKey, Keypair, Transaction, SystemProgram, LAMPORTS_PER_SOL, sendAndConfirmTransaction} from '@solana/web3.js';import { createMint, createAccount, mintTo, getOrCreateAssociatedTokenAccount, createTransferInstruction, getAccount, createInitializeMintInstruction, createInitializeAccountInstruction, createMintToInstruction, MINT_SIZE, TOKEN_PROGRAM_ID, getMinimumBalanceForRentExemptMint} from '@solana/spl-token';- Line 8
sendAndConfirmTransaction: Submits the signed transaction to the cluster. - Line 15
createTransferInstruction,: An SPL token transfer through the Token Program. - Line 19
createMintToInstruction,: Mints new tokens. The mint authority must sign.
frontend/lib/nft-minting.ts L1–23 @ 3ccc785 · MIT · originalimport { Connection, PublicKey, Keypair, Transaction, SystemProgram, LAMPORTS_PER_SOL, sendAndConfirmTransaction} from '@solana/web3.js';import { createMint, createAccount, mintTo, getOrCreateAssociatedTokenAccount, createTransferInstruction, getAccount, createInitializeMintInstruction, createInitializeAccountInstruction, createMintToInstruction, MINT_SIZE, TOKEN_PROGRAM_ID, getMinimumBalanceForRentExemptMint} from '@solana/spl-token';- Line 8
sendAndConfirmTransaction: Submits the signed transaction to the cluster. - Line 15
createTransferInstruction,: An SPL token transfer through the Token Program. - Line 19
createMintToInstruction,: Mints new tokens. The mint authority must sign.
frontend/app/merchant/page.tsx L109–131 @ 3ccc785 · MIT · original }) ); // Add memo with redemption data const memo = `R:MBS-20OFF-2024:20`; transaction.add( new TransactionInstruction({ keys: [], programId: new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'), data: Buffer.from(memo, 'utf-8') }) ); // Get recent blockhash const { blockhash } = await connection.getLatestBlockhash(); transaction.recentBlockhash = blockhash; transaction.feePayer = publicKey; console.log('📝 Transaction created, sending...'); // Send transaction const signature = await sendTransaction(transaction, connection); console.log('✅ Transaction sent:', signature);- Line 123
const { blockhash } = await connection.getLatestBlockhash();: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 130
const signature = await sendTransaction(transaction, connection);: Submits the signed transaction to the cluster.
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 |
|---|---|---|
. | npm run dev | bun --watch api/server.ts |
. | npm run start | bun run api/server.ts |
frontend | npm run dev | next dev |
frontend | npm run start | next start |
frontend | npm run build | next build |
frontend | npm run lint | next lint |
What you could build from it
- Fork the SuperStack copy and extend it within the NFTs & Digital Assets gaps listed on the idea page.
- Learn the pattern first: NFTs with Metaplex
- Learn the pattern first: Compressed NFTs and state compression
- Learn the pattern first: Token-2022 (Token Extensions)