Development Environment
Module 1: Setting Up Your BSV Development Environment
This module guides you through setting up your development environment for BSV blockchain development. The setup differs depending on whether you're building backend services or frontend dApps.
Universal Prerequisites
Required for both paradigms:
Computer running Windows, macOS, or Linux
Basic command line knowledge
Text editor or IDE (VS Code recommended)
Node.js 18+ and npm
Part 1: Universal Setup (Both Paradigms)
Step 1: Install Node.js
The BSV TypeScript SDK requires Node.js version 18 or higher.
macOS
# Using Homebrew
brew install node
# Verify installation
node --version # Should be v18.0.0 or higher
npm --versionWindows
Download installer from nodejs.org (LTS version)
Run the installer
Verify in Command Prompt:
Linux (Ubuntu/Debian)
Step 2: Install TypeScript
Step 3: Set Up Your IDE
We recommend Visual Studio Code for TypeScript development:
Download from code.visualstudio.com
Install these essential extensions:
ESLint: Code quality and linting
Prettier: Automatic code formatting
TypeScript Import Sorter: Organize imports
GitLens: Git integration and history
VS Code Settings
Create .vscode/settings.json in your project:
Step 4: Install BSV SDK
Step 5: Configure TypeScript
Create tsconfig.json:
Step 6: Set Up Git (Recommended)
Part 2A: Backend/Service Development Setup
For custodial applications where you control private keys
Backend Project Structure
Install Backend Dependencies
Environment Variables (Backend)
Create .env file:
⚠️ Security Warning:
Never store production private keys in
.envfilesUse HSM (Hardware Security Module) or key vaults in production
Always encrypt private keys at rest
Use strong access controls
Backend Test File
Create src/index.ts:
Backend NPM Scripts
Update package.json:
Test Backend Setup
Part 2B: Frontend/dApp Development Setup
For non-custodial applications using WalletClient
Frontend Project Structure (React Example)
Install Frontend Dependencies
Frontend Test Component
Create src/components/WalletTest.tsx:
Update App.tsx
Frontend NPM Scripts
package.json (already configured by Create React App):
Test Frontend Setup
MetaNet Desktop Wallet Installation (BSV Desktop)
Required for frontend development:
What is BSV Desktop? BSV Desktop (formerly MetaNet Desktop Wallet) is a modern wallet designed to make your experience with BSV Blockchain simple, secure, and powerful—whether you're a beginner or an advanced user. It's the standard wallet for BSV application development.
Download and Setup:
Visit: https://desktop.bsvb.tech/
Download for your OS (Windows, macOS, or Linux)
Run the installer and follow the setup wizard
Create a new wallet or import existing one
Switch to testnet mode for development (Settings → Network → Testnet)
Getting BSV for Development:
Testnet BSV (for development): Use the built-in wallet faucet feature or request from BSV Discord
Mainnet BSV (for production): Orange Gateway (buy with fiat)
Key Features for Developers:
Multi-network support (mainnet/testnet switching)
App integration for blockchain applications
Welcome gift: 99,991 Satoshis to start exploring
Advanced security with phone-based recovery
Identity Key and Private Key management for app integration
Your dApp will connect to this wallet via WalletClient
Complete Onboarding Guide:
https://hub.bsvblockchain.org/demos-and-onboardings/onboardings/onboarding-catalog/metanet-desktop-mainnet
Documentation:
Wallet Toolbox API: https://fast.brc.dev/
BRC Standards: https://hub.bsvblockchain.org/brc
Tech Stack & Resources: https://hub.bsvblockchain.org/bsv-skills-center
Part 3: Testing Your Setup
Backend Test
Expected Output:
Frontend Test
Expected Behavior:
Browser opens at http://localhost:3000
Click "Connect MetaNet Desktop Wallet"
Wallet popup appears
Authorize connection
See "✅ Wallet connected successfully!"
Public key displayed (truncated for security)
Additional Tools
Block Explorers
WhatsOnChain:
Mainnet: https://whatsonchain.com/
Testnet: https://test.whatsonchain.com/
Usage:
View transactions by TXID
Check address balances
Explore blocks and network stats
Debug transaction issues
Getting Testnet BSV
Get free testnet BSV for development:
Use MetaNet Desktop Wallet's built-in faucet feature
Join BSV Discord to request testnet coins from the community
Use for testing without real funds
API Documentation
BSV SDK Docs: https://bsv-blockchain.github.io/ts-sdk/
Wallet Toolbox Reference: https://fast.brc.dev/
BRC Standards: https://hub.bsvblockchain.org/brc
Environment Variables Best Practices
Backend (.env)
Frontend (.env)
Security Rules:
✅ Always add
.envto.gitignore✅ Use different
.envfiles for dev/prod✅ Never commit private keys
✅ Use environment variables for all secrets
✅ In backend production, use HSM or key vaults
Troubleshooting
"Cannot find module '@bsv/sdk'"
"WalletClient connection failed"
Checklist:
✅ MetaNet Desktop Wallet installed?
✅ Wallet unlocked?
✅ Testnet mode if using testnet?
✅ dApp origin authorized in wallet?
Solution:
TypeScript Errors
Permission Errors (Linux/macOS)
Port Already in Use
Verification Checklist
Backend Development Ready
✅ Node.js 18+ installed
✅ TypeScript 5.0+ installed
✅ BSV SDK installed
✅ Project structure created
✅ Test script runs successfully
✅
.envfile configured✅ Git initialized
Frontend Development Ready
✅ Node.js 18+ installed
✅ React project created
✅ BSV SDK installed
✅ MetaNet Desktop Wallet installed
✅ Wallet connection test works
✅ Test component renders
✅ Git initialized
Next Steps
Now that your environment is ready, continue to:
For Both Paradigms:
BSV Fundamentals - Learn UTXO model, transactions, scripts
Then Choose Your Path:
Backend Developers:
Managing Wallets Server-Side - Server-side wallet management
Building Transactions Programmatically - Transaction creation
Frontend Developers:
WalletClient Integration - Connect to user wallets
Building dApps with WalletClient - Request user signatures
Related Resources
Official Documentation
Tools
BSV Discord Community - Get help and testnet coins
Community
Your development environment is now ready! Let's learn BSV fundamentals.
Last updated
