Workshop Duration: ~90 minutes Skill Level: Intermediate (basic terminal and Bitcoin knowledge helpful) What Attendees Will Learn: How to set up a complete Stratum V2 mining stack from scratch
- Pre-Workshop Setup
- Part 1: Bitcoin Core Setup (15 min)
- Part 2: SV2 Template Provider Setup (10 min)
- Part 3: Building the SV2 Stack (20 min)
- Part 4: Running Your First SV2 Pool (15 min)
- Part 5: Connecting Mining Hardware (20 min)
- Part 6: Monitoring and Verification (10 min)
- Troubleshooting
- macOS, Linux, or Windows WSL2
- 50GB+ free disk space
- 8GB+ RAM recommended
- Internet connection (for initial sync/downloads)
- Optional: Bitaxe, Apollo, or other SV2-compatible miner
~/workshop/
βββ bitcoin-30.0/ # Bitcoin Core binaries
βββ sv2-tp-1.0.3/ # Template Provider
βββ stratum-v2-tools/ # Our SV2 daemon project
What we're doing: Getting the latest Bitcoin Core release with required features.
# Create workshop directory
mkdir -p ~/workshop && cd ~/workshop
# Download Bitcoin Core v30.0 (adjust for your platform)
# For macOS ARM64:
wget https://bitcoincore.org/bin/bitcoin-core-30.0/bitcoin-30.0-arm64-apple-darwin.tar.gz
# For macOS x86_64:
wget https://bitcoincore.org/bin/bitcoin-core-30.0/bitcoin-30.0-x86_64-apple-darwin.tar.gz
# For Linux x86_64:
wget https://bitcoincore.org/bin/bitcoin-core-30.0/bitcoin-30.0-x86_64-linux-gnu.tar.gzπ‘ Workshop Tip: While downloading, explain why we need Bitcoin Core v30.0:
- Supports IPC mode (
-m node -ipcbind=unix) required by sv2-tp - Improved RPC interface for template generation
- Better performance for mining operations
# Extract (adjust filename for your platform)
tar -xzf bitcoin-30.0-arm64-apple-darwin.tar.gz
# Verify it works
./bitcoin-30.0/bin/bitcoind --versionExpected Output:
Bitcoin Core version v30.0.0
What we're doing: Starting a private Bitcoin network for testing (no real money!).
# Start bitcoind in regtest mode with required flags
./bitcoin-30.0/bin/bitcoind \
-regtest \
-m node \
-ipcbind=unix \
-rpcuser=sv2user \
-rpcpassword=sv2pass123 \
-rpcport=18443 \
-daemon \
-txindexπ‘ Workshop Explanation:
-regtest= Private test network, instant blocks-m node= Multiprocess mode (required for sv2-tp IPC)-ipcbind=unix= Enable Unix socket IPC-daemon= Run in background-txindex= Index all transactions (helpful for debugging)
# Check blockchain info
./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 -rpcport=18443 getblockchaininfoExpected Output:
{
"chain": "regtest",
"blocks": 0,
"headers": 0,
...
}Why: Need 101+ blocks to have spendable Bitcoin for testing.
# Create a wallet
./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 createwallet "mining_wallet"
# Get a mining address
MINING_ADDR=$(./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getnewaddress)
echo "Mining to: $MINING_ADDR"
# Mine 101 blocks (makes first 1 spendable)
./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 generatetoaddress 101 $MINING_ADDR
# Verify balance
./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getbalanceExpected Output:
50.00000000
β Checkpoint: Bitcoin Core is running and we have test Bitcoin!
What we're doing: Getting the component that creates block templates for miners.
cd ~/workshop
# Download sv2-tp v1.0.3
wget https://github.com/Sjors/sv2-tp/releases/download/v1.0.3/sv2-tp-1.0.3-x86_64-apple-darwin.tar.gz
# Extract
tar -xzf sv2-tp-1.0.3-x86_64-apple-darwin.tar.gzCRITICAL DISCOVERY: sv2-tp v1.0.3 changed Bitcoin Core connection method!
cd sv2-tp-1.0.3
# Create config file
cat > sv2-tp.toml <<'EOF'
# Bitcoin Core IPC connection (v1.0.3 NEW requirement!)
bitcoind_url = "unix:///Users/YOUR_USERNAME/.bitcoin/regtest/node.sock"
# Template Provider listening ports
tp_address = "127.0.0.1:18447"
core_rpc_url = "http://127.0.0.1:18443"
core_rpc_user = "sv2user"
core_rpc_pass = "sv2pass123"
# Coinbase outputs (where block rewards go)
[[coinbase_outputs]]
output_script_type = "P2WPKH"
output_script_value = "bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyea"
EOF
# IMPORTANT: Replace YOUR_USERNAME with actual username
sed -i '' "s/YOUR_USERNAME/$(whoami)/g" sv2-tp.tomlπ‘ Workshop Teaching Point: Show the breaking change in v1.0.3:
- β Old v1.0.2: Used
-chain=regtestflag - β
New v1.0.3: Must use
bitcoind_url = "unix://..."in config - This caused hours of debugging - share the learning!
# Start Template Provider
./bin/sv2-tp --config sv2-tp.toml > /tmp/sv2-tp.log 2>&1 &
# Wait for startup
sleep 3
# Check it's running
tail -20 /tmp/sv2-tp.logExpected Output:
[sv2:info] Template Provider starting...
[sv2:info] Template Provider authority key: 9cEoWDHp2KtT3pUYaAsjS6yzquNv8QXx3qvCmu8iz8WJ1EB3jUj
[sv2:info] Listening on 127.0.0.1:18447
[sv2:info] Connected to Bitcoin Core via IPC
β Checkpoint: sv2-tp is running and connected to Bitcoin Core!
What we're doing: Getting our plug-and-play SV2 daemon code.
cd ~/workshop
# Clone the stratum-v2-tools repository
git clone https://github.com/YOUR_USERNAME/stratum-v2-tools.git
cd stratum-v2-toolsNote: This project includes both our custom code AND the Stratum Reference Implementation.
# Initialize submodules (pulls in stratum-reference)
git submodule update --init --recursive
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/envWhat we're building:
pool_sv2- The SV2 pool servertranslator_sv2- Converts SV1 miners to SV2
# Build the Stratum Reference Implementation
cd stratum-reference/roles
cargo build --release
# Verify builds
ls target/release/ | grep -E "(pool_sv2|translator_sv2)"Expected Output:
pool_sv2
translator_sv2
π‘ Workshop Tip: This takes 5-10 minutes. Use this time to:
- Explain Stratum V1 vs V2 differences
- Discuss why we need a translator (legacy hardware)
- Show the architecture diagram
# Return to project root
cd ../..
# Build sv2d and sv2-cli
cargo build --release
# Verify
ls target/release/ | grep -E "(sv2d|sv2-cli)"Expected Output:
sv2d
sv2-cli
# Verify config exists
cat config/regtest_solo.tomlExpected Config:
[network]
mode = "regtest"
[bitcoin]
rpc_url = "http://127.0.0.1:18443"
rpc_user = "sv2user"
rpc_password = "sv2pass123"
[pool]
coinbase_address = "bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyea"
signature = "SV2 Workshop Demo Pool"
[sv2_tp]
binary_path = "/Users/YOUR_USERNAME/workshop/sv2-tp-1.0.3/bin/sv2-tp"
listen_port = 18447Action: Update binary_path with your actual path:
# Auto-update the path
sed -i '' "s|/Users/YOUR_USERNAME|$HOME|g" config/regtest_solo.tomlβ Checkpoint: All components built successfully!
What's about to happen:
- sv2d will start sv2-tp (if not running)
- Start the SV2 pool server
- Start the SV1βSV2 translator
- All components auto-configure and connect
# Start sv2d
./target/release/sv2d --config config/regtest_solo.toml &
# Watch the logs
tail -f /tmp/sv2d.logExpected Log Output:
[INFO] sv2d starting in regtest mode
[INFO] Starting Bitcoin Core...
[INFO] Bitcoin Core already running β
[INFO] Starting sv2-tp...
[INFO] π Extracted sv2-tp authority key: 9cEoWDHp2KtT3pUYaAsjS6yzquNv8QXx3qvCmu8iz8WJ1EB3jUj
[INFO] π Generating pool config with authority key: 9cEoWDHp2KtT3pUYaAsjS6yzquNv8QXx3qvCmu8iz8WJ1EB3jUj
[INFO] Starting SV2 pool...
[INFO] Pool listening on 0.0.0.0:34254
[INFO] Starting SV1βSV2 translator...
[INFO] Translator listening on 0.0.0.0:3333
[INFO] β
All components started successfully
π‘ Workshop Teaching Moment: Point out the automatic authority key extraction - this is the plug-and-play magic!
- sv2-tp generates a random authority key on startup
- sv2d extracts it from logs
- Pool and translator configs are generated dynamically
- No manual config editing needed!
# Use sv2-cli to check status
./target/release/sv2-cli statusExpected Output:
SV2 Daemon Status
=================
Bitcoin Core: β Running (regtest, 101 blocks)
SV2-TP: β Running (listening on :18447)
Pool: β Running (0 miners connected)
Translator: β Running (listening on :3333)
Pool Address: 0.0.0.0:3333 (for SV1 miners)
0.0.0.0:34254 (for SV2 miners)
Blocks Found: 0
Demo the system is ready for miners:
# Test that translator port is open
nc -zv 127.0.0.1 3333Expected Output:
Connection to 127.0.0.1 port 3333 [tcp/*] succeeded!
β Checkpoint: Your SV2 pool is running and ready for miners!
For local network mining:
# macOS/Linux
ifconfig | grep "inet " | grep -v 127.0.0.1
# Note your local IP (e.g., 10.0.0.8)Expected Output:
inet 10.0.0.8 netmask 0xffffff00 broadcast 10.0.0.255
π‘ Workshop Demo: Show the Bitaxe web interface live.
- Open browser to Bitaxe IP (e.g.,
http://10.0.0.2) - Navigate to Settings β Pool Configuration
- Configure:
Pool URL: stratum+tcp://10.0.0.8:3333 Username: bitaxe_workshop_1 Password: x - Click Save
What to expect:
- Bitaxe will disconnect from old pool
- Reconnect to our pool in ~10 seconds
- Green LED should stabilize
- Open browser to Apollo IP (e.g.,
http://10.0.0.10) - Navigate to Miner Configuration β Pool Settings
- Configure Pool 1:
URL: stratum+tcp://10.0.0.8:3333 Worker: apollo_workshop_1 Password: x - Click Save & Apply
For attendees without mining hardware:
If you don't have a Bitaxe or other ASIC miner, you can use CPU mining software to demonstrate the full stack.
Install cpuminer-multi:
# macOS (using Homebrew)
brew install cpuminer
# Linux (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y build-essential libcurl4-openssl-dev git
git clone https://github.com/tpruvot/cpuminer-multi
cd cpuminer-multi
./build.shStart CPU Mining:
# Get your server IP first
SERVER_IP=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -1)
echo "Mining to: $SERVER_IP:3333"
# Start cpuminer (macOS with Homebrew)
cpuminer -a sha256d -o stratum+tcp://$SERVER_IP:3333 -u workshop_cpu_miner -p x --coinbase-addr=bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyea
# OR if you built from source
./cpuminer -a sha256d -o stratum+tcp://$SERVER_IP:3333 -u workshop_cpu_miner -p x --coinbase-addr=bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyeaExpected CPU Miner Output:
[2025-10-25 08:00:00] Starting Stratum on stratum+tcp://10.0.0.8:3333
[2025-10-25 08:00:00] Binding thread 0 to cpu 0
[2025-10-25 08:00:00] Binding thread 1 to cpu 1
[2025-10-25 08:00:01] Stratum connection established
[2025-10-25 08:00:01] Stratum difficulty set to 1
[2025-10-25 08:00:02] CPU #0: 125.5 kH/s
[2025-10-25 08:00:02] CPU #1: 121.2 kH/s
π‘ Workshop Note:
- CPU mining is VERY slow (~250 kH/s vs 500 GH/s for Bitaxe)
- On regtest it still works - you'll find blocks, just slower
- This proves the SV2 stack works without specialized hardware
- Perfect for testing and development
Alternative: Use Bitcoin Core's generatetoaddress for Quick Demo:
If even CPU mining is too slow, you can simulate block discovery:
# Generate 5 blocks instantly (simulating miner finding them)
~/workshop/bitcoin-30.0/bin/bitcoin-cli -datadir=/tmp/bitcoin_regtest -rpcuser=test -rpcpassword=test -rpcport=18443 generatetoaddress 5 bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyea
# Watch the pool logs to see it receive new templates
tail -20 /tmp/pool.logWhen to use each method:
- Hardware (Bitaxe/Apollo): Best for showing real mining hardware in action
- CPU Miner: Good for attendees to participate without hardware
- generatetoaddress: Quick demo when you just need to show the stack working
# Check translator logs
tail -f /tmp/translator-regtest.logExpected Output:
[INFO] New connection from 10.0.0.2:58386
[INFO] Miner authorized: bitaxe_workshop_1
[INFO] SetDifficulty sent to 10.0.0.2
[INFO] New mining job sent to bitaxe_workshop_1
[INFO] New connection from 10.0.0.10:33092
[INFO] Miner authorized: apollo_workshop_1
[INFO] SetDifficulty sent to 10.0.0.10
[INFO] New mining job sent to apollo_workshop_1
# See active miner connections
lsof -i :3333Expected Output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
translato 1234 user 10u IPv4 0x... 0t0 TCP 10.0.0.8:3333->10.0.0.2:58386 (ESTABLISHED)
translato 1234 user 11u IPv4 0x... 0t0 TCP 10.0.0.8:3333->10.0.0.10:33092 (ESTABLISHED)
β Checkpoint: Miners are connected and hashing!
Monitor share submissions:
# Watch translator logs in real-time
tail -f /tmp/translator-regtest.log | grep -i shareExpected Output (on regtest, shares will be rejected - this is normal!):
[INFO] Share received from bitaxe_workshop_1: difficulty=1.0
[WARN] Invalid share for channel id: 0/2
[INFO] Share received from apollo_workshop_1: difficulty=1.0
[WARN] Invalid share for channel id: 0/2
π‘ Workshop Explanation:
- On regtest: Network difficulty is VERY low (1)
- Miners find shares constantly but they're "too easy" for pool
- This is expected behavior - shares WILL work on signet/mainnet!
- What matters: Miners are submitting work
Let's mine some blocks!
# Monitor block count
watch -n 5 './bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getblockcount'In another terminal:
# Check for new blocks every 30 seconds
for i in {1..10}; do
echo "=== Check $i ==="
./target/release/sv2-cli status
sleep 30
doneWhat to look for:
- Block count increasing (101 β 102 β 103...)
- Blocks found by our pool showing in
sv2-cli status
# Get latest block
LATEST_BLOCK=$(./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getblockcount)
# Get block details
./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getblock $(./bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getblockhash $LATEST_BLOCK) 2Look for our coinbase address in the output:
{
"tx": [
{
"vout": [
{
"value": 50.00000000,
"scriptPubKey": {
"address": "bcrt1qe8le5cgtujqrx9r85e8q4r6zjy4c227zhgtyea"
}
}
]
}
]
}β Success! That's our mining address - we found the block!
# Quick status check
./target/release/sv2-cli statusFinal Status Display:
SV2 Daemon Status
=================
Bitcoin Core: β Running (regtest, 105 blocks)
SV2-TP: β Running (listening on :18447)
Pool: β Running (2 miners connected)
Translator: β Running (listening on :3333)
Connected Miners:
β’ bitaxe_workshop_1 (10.0.0.2) - 500 GH/s
β’ apollo_workshop_1 (10.0.0.10) - 2.5 TH/s
Blocks Found: 4
Total Shares: 1,247 (accepted: 0, rejected: 1,247)
Pool Address: 10.0.0.8:3333
Uptime: 45 minutes
π‘ Workshop Wrap-Up Points:
- β Complete SV2 stack running from scratch
- β Multi-miner support demonstrated
- β Plug-and-play config generation working
- β Real mining hardware connected
- β Blocks being found and attributed correctly
Symptom:
Error: Cannot obtain a lock on data directory
Solution:
# Kill existing bitcoind
pkill -9 bitcoind
# Wait 5 seconds
sleep 5
# Restart
./bitcoin-30.0/bin/bitcoind -regtest -m node -ipcbind=unix ...Symptom:
[ERROR] Failed to connect to Bitcoin Core IPC socket
Solution:
# Verify Bitcoin Core is running in multiprocess mode
ps aux | grep bitcoind
# Should show: -m node -ipcbind=unix
# Check socket exists
ls ~/.bitcoin/regtest/node.sock
# If missing, restart Bitcoin Core with correct flagsSymptom: sv2-cli status shows 0 miners connected
Checklist:
-
β Verify translator is listening:
lsof -i :3333
-
β Check firewall (macOS):
# Allow incoming connections sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add $(pwd)/stratum-reference/roles/target/release/translator_sv2 sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp $(pwd)/stratum-reference/roles/target/release/translator_sv2
-
β Verify network connectivity:
# From miner's network, test server nc -zv YOUR_SERVER_IP 3333 -
β Check miner configuration:
- Correct IP address?
- Correct port (3333)?
- Using
stratum+tcp://prefix?
Symptom:
[WARN] Invalid share for channel id: 0/2
This is EXPECTED on regtest!
Explanation:
- Regtest network difficulty = 1 (very low)
- Pool difficulty = Higher (e.g., 1024)
- Miners submit shares meeting network difficulty
- Pool rejects shares that don't meet pool difficulty
- Blocks ARE still being found (check
getblockcount)
Verification:
# Blocks ARE increasing - mining works!
watch -n 5 './bitcoin-30.0/bin/bitcoin-cli -regtest -rpcuser=sv2user -rpcpassword=sv2pass123 getblockcount'For production: Use signet or mainnet where difficulties align properly.
Symptom:
[ERROR] Pool connection failed: Handshake failed
[ERROR] Authority verification failed
Solution: This is what our dynamic config generation fixes!
# Check extracted authority key
grep "authority key" /tmp/sv2d.log
# Check pool config used
cat /tmp/pool_regtest.toml | grep authority_public_key
# They should MATCH!If they don't match, restart sv2d:
./target/release/sv2-cli stop
./target/release/sv2d --config config/regtest_solo.toml &Q: Why use regtest instead of testnet? A: Instant blocks, full control, no waiting for confirmations. Perfect for demos and development.
Q: Can I use this on mainnet?
A: Yes! Change config to mode = "mainnet" and point to mainnet Bitcoin Core. All components support production use.
Q: What's the difference between SV1 and SV2? A:
- SV1: Centralized, pool controls everything, vulnerable to manipulation
- SV2: Decentralized, miners can select transactions, better security, more efficient
Q: Why do we need sv2-tp? A: sv2-tp generates block templates from Bitcoin Core and provides them to pools. It enables true decentralization - miners validate their own work against Bitcoin Core, not just pool rules.
Q: Do miners need special firmware for SV2? A: Not with our translator! We convert SV1 (legacy) to SV2, so standard miners work out-of-the-box.
Q: How do I switch from regtest to signet? A:
- Stop sv2d:
./target/release/sv2-cli stop - Update config:
mode = "signet" - Start Bitcoin Core in signet mode
- Restart sv2d:
./target/release/sv2d --config config/signet.toml &
Q: What hardware can connect? A: Any Stratum V1 miner:
- Bitaxe (all models)
- Antminer S9/S19
- Whatsminer M20/M30
- Apollo BTC
- Any ASIC with SV1 support
- CPU miners (cpuminer, cpuminer-multi)
Q: Can I test without mining hardware? A: Yes! Three options:
- CPU Mining: Install
cpuminerand mine with your laptop/computer (see Step 5.4) - generatetoaddress: Use Bitcoin Core to simulate block discovery instantly
- Cloud Mining: Rent hashrate from NiceHash/MiningRigRentals and point it to your pool
CPU mining is perfect for learning - you'll find blocks on regtest, just slower than ASICs.
- β Star the repo: https://github.com/YOUR_USERNAME/stratum-v2-tools
- π Read detailed docs:
README.md - π§ͺ Try signet mode (real network, free testnet coins)
- π Contribute: Open issues/PRs for improvements
- π¬ Join community: [Discord/Telegram link]
- Solo Mining on Mainnet: Update config, point to mainnet node, connect real hashrate
- Pool Operation: Configure payout addresses, set pool fees, manage multiple miners
- Custom Block Templates: Modify sv2-tp config to include specific transactions
- Monitoring: Integrate with Grafana/Prometheus for production monitoring
Built With:
- Bitcoin Core - The Bitcoin node
- sv2-tp - Template Provider
- Stratum Reference Implementation - SRI Pool and Translator
- Our SV2 Daemon - Plug-and-play orchestration
Special Thanks:
- @Sjors for sv2-tp development and v1.0.3 fixes
- SRI team for the robust pool/translator implementation
- Bitcoin Core developers for IPC support
Document Version: 1.0 Last Updated: 2025-10-25 Tested On: macOS (ARM64), Bitcoin Core v30.0, sv2-tp v1.0.3