Utilitary Token Platform
Full-Stack Token System with Overlay Validation
Build a complete token platform combining frontend token management, overlay service validation, and MongoDB indexing. This project brings together all BSV patterns including PushDrop tokens (BRC-48), overlay architecture (BRC-57), two-phase signing, and peer-to-peer transfers.
What You'll Build
A production-ready token platform featuring:
Frontend Application: React UI for minting, transferring, and managing tokens
Overlay Service: Transaction validation and UTXO indexing with MongoDB
Token Protocol: Fungible tokens with balance conservation rules
P2P Transfers: Off-chain messaging via MessageBox (BRC-33)
Privacy Features: Unique derived addresses per output (BRC-42)
📦 Complete Code Example
The full working implementation of this token platform is available on GitHub:
Repository: github.com/sirdeggen/demo-day/tree/main/tokenization
This repository contains:
/frontend- Complete React application for token management/overlay- Full overlay service with Topic Manager and Lookup Service
You can clone the repository to explore the complete, production-ready implementation alongside the tutorials below.
Learning Objectives
By completing this project, you will learn:
Full-Stack BSV Architecture - Frontend + backend overlay integration
PushDrop Tokens (BRC-48) - Fungible token creation and transfers
Overlay Services (BRC-57) - Protocol-specific validation and indexing
Two-Phase Signing - Manual token input signing with wallet BSV signing
BEEF Format (BRC-62) - Transaction packaging with SPV proofs
MongoDB Integration - Efficient UTXO storage and querying
MessageBox (BRC-33) - Peer-to-peer token transfer notifications
BRC-42 Key Derivation - Privacy-enhanced addresses
Prerequisites
Before starting this project, you should complete:
Token Fundamentals - Understanding PushDrop token structure
Overlay Services - Understanding overlay architecture
Beginner Path - BSV fundamentals
You should be familiar with:
TypeScript/JavaScript
React basics
Node.js and Express
MongoDB fundamentals
BSV transaction structure
Project Structure
This project is divided into two main components:
Build the backend validation and indexing service:
Topic Manager for protocol validation
Lookup Service for UTXO indexing
MongoDB storage layer
REST API endpoints
Balance conservation rules
Tech Stack: Node.js, Express, MongoDB, BSV SDK
Build the user-facing token management interface:
Token minting with PushDrop
Two-phase transaction signing
Token wallet with balance aggregation
MessageBox P2P transfers
Overlay validation integration
Tech Stack: React, Vite, BSV SDK, WalletClient
Architecture Overview
Getting Started
Recommended Order
Start with Overlay Service (overlay-service.md)
Set up MongoDB
Build Topic Manager
Create Lookup Service
Test validation rules
Build Frontend Application (frontend-application.md)
Set up React project
Integrate WalletClient
Implement token minting
Add transfer functionality
Connect to overlay service
Setup Requirements
System Requirements:
Node.js 18+
MongoDB 5.0+
BSV Desktop Wallet
TypeScript 4.9+
BSV Requirements:
BSV Desktop Wallet installed and unlocked
Test BSV for transaction fees (get from faucet)
Key Concepts
Token Structure (PushDrop 3-Field Format)
Token Lifecycle
Mint: Create token with
'___mint___'marker → tokenId becomestxid.voutTransfer: Spend input UTXOs → create output UTXOs with same tokenId
Split: One input → multiple outputs (recipient + change)
Merge: Multiple inputs → one output (combining balances)
Balance Conservation Rule
The overlay validates that inputs equal outputs:
Valid Transfer:
Invalid Transfer:
Privacy Model
Every token output uses a unique derived address via BRC-42:
Random
keyIDper output prevents address reuseCannot link multiple UTXOs to same owner
Requires storing
customInstructionsto spend later
Two-Phase Signing
Phase 1: Wallet adds BSV inputs and estimates unlock script lengths
Phase 2: Manually sign token inputs using stored customInstructions
Phase 3: Submit signatures to wallet for finalization
This is required because wallet cannot derive PushDrop unlock scripts automatically.
Testing the Complete System
1. Start Overlay Service
2. Start Frontend
3. Test Token Flow
Mint tokens: Create new token supply in frontend
Check overlay: Verify tokens indexed in MongoDB
Transfer tokens: Send to another user via MessageBox
Receive tokens: Recipient claims tokens in their wallet
Query balances: View aggregated token balances
Troubleshooting
"Failed to connect to wallet"
Install BSV Desktop Wallet from https://desktop.bsvb.tech/
Unlock wallet before using frontend
"Overlay rejected transaction"
Check balance conservation (inputs must equal outputs)
Verify token structure (3-field PushDrop format)
Check MongoDB connection
"Cannot spend tokens"
Verify
customInstructionsstored when creating outputsCheck protocolID and keyID match stored values
"Tokens not appearing"
Verify correct basket name (
demotokens3or your custom name)Check overlay admission logs
Query MongoDB directly to verify indexing
Enhancements
Once you've completed the base project, try these extensions:
Frontend Enhancements
Batch token transfers (multiple recipients)
Token metadata editor
Transaction history viewer
Balance charts and analytics
Overlay Enhancements
Spend tracking (
outputSpenthook)Token registry (whitelist/blacklist)
Metadata validation rules
Custom query endpoints
Protocol Extensions
Non-fungible tokens (NFTs)
Token burning mechanism
Multi-signature token controls
Timelocked token releases
Project Completion Checklist
Summary
This project demonstrates a complete BSV token system combining:
Frontend token management (React + WalletClient)
Backend validation (Overlay Services)
Protocol enforcement (Balance conservation rules)
Efficient indexing (MongoDB with optimized queries)
Privacy features (BRC-42 key derivation)
P2P transfers (MessageBox notifications)
These patterns form the foundation for building production-grade token systems, NFT marketplaces, loyalty programs, and other tokenized applications on BSV.
Related Resources
BRC Standards
Documentation
Prerequisites
Last updated
