Bitcoin Beginner 8 min read
Bitcoin Test Networks
Guide to Bitcoin testnet, signet, and regtest for agent development. Free coins, testing environments, and best practices.
testnet signet regtest development testing
Bitcoin Test Networks
Never test with real bitcoins. Bitcoin provides multiple test networks for development and experimentation.
Network Comparison
| Network | Coins | Block Time | Stability | Use Case |
|---|---|---|---|---|
| Mainnet | Real BTC | ~10 min | Stable | Production |
| Testnet3 | Free tBTC | ~10 min | Variable | Integration testing |
| Signet | Free sBTC | ~10 min | Stable | Reliable testing |
| Regtest | Generated | Instant | Local | Unit testing |
Testnet3
The primary public test network since 2012.
Characteristics
- Address prefix:
morn(P2PKH),2(P2SH),tb1(Bech32) - Genesis block: Different from mainnet
- Difficulty: Resets if no block for 20 minutes
- Coins: Free from faucets
API Access
# mempool.space testnet
curl https://mempool.space/testnet/api/blocks/tip/height
# Address info
curl https://mempool.space/testnet/api/address/{address}
Faucets
| Faucet | URL |
|---|---|
| coinfaucet.eu | https://coinfaucet.eu/en/btc-testnet/ |
| mempool.co | https://testnet-faucet.mempool.co/ |
| bitcoinfaucet | https://bitcoinfaucet.uo1.net/ |
Limitations
- Unstable difficulty: Long block times during low activity
- Spam: Sometimes flooded with test transactions
- Reorgs: More common than mainnet
Signet
A more reliable test network with signed blocks (BIP-325).
Characteristics
- Address prefix: Same as testnet (
tb1) - Block signing: Centralized signers (default: Bitcoin Core devs)
- Predictable blocks: ~10 minutes, no difficulty resets
- Coins: Free from faucets
Why Use Signet?
| Testnet | Signet |
|---|---|
| Unpredictable blocks | Consistent 10-min blocks |
| Difficulty resets | Stable difficulty |
| Anyone can mine | Signed by authorities |
| More reorgs | Fewer reorgs |
API Access
# mempool.space signet
curl https://mempool.space/signet/api/blocks/tip/height
Faucet
Configuration
# bitcoin.conf
signet=1
[signet]
signetchallenge=... # Default uses Bitcoin Core signet
Regtest (Regression Test)
Local, private test network for development.
Characteristics
- No network: Runs locally only
- Instant blocks: Generate on demand
- Full control: You create all blocks and transactions
- Perfect for: Unit tests, CI/CD
Setup
# Start regtest node
bitcoind -regtest -daemon
# Create wallet
bitcoin-cli -regtest createwallet "test"
# Generate address
bitcoin-cli -regtest getnewaddress
# Mine 101 blocks (100 for maturity + 1)
bitcoin-cli -regtest generatetoaddress 101 <address>
# Check balance
bitcoin-cli -regtest getbalance
Instant Transactions
# Send transaction
bitcoin-cli -regtest sendtoaddress <address> 1.0
# Mine block to confirm
bitcoin-cli -regtest generatetoaddress 1 <mining_address>
Network-Specific Settings
Address Prefixes
| Type | Mainnet | Testnet/Signet |
|---|---|---|
| P2PKH | 1 | m or n |
| P2SH | 3 | 2 |
| Bech32 | bc1 | tb1 |
Version Bytes
| Key Type | Mainnet | Testnet |
|---|---|---|
| WIF | 0x80 | 0xef |
| xpub | 0x0488B21E | 0x043587CF |
| xprv | 0x0488ADE4 | 0x04358394 |
Agent Development Workflow
1. Unit Tests (Regtest)
# Fast, isolated tests
def test_transaction_creation():
# Generate blocks for funds
rpc.generatetoaddress(101, address)
# Create and broadcast transaction
txid = rpc.sendtoaddress(recipient, 0.1)
# Mine to confirm
rpc.generatetoaddress(1, address)
# Verify
tx = rpc.gettransaction(txid)
assert tx['confirmations'] == 1
2. Integration Tests (Signet)
# Realistic testing with stable network
def test_payment_flow():
# Get signet coins from faucet first
# Test with real network conditions
txid = broadcast_transaction(signed_tx)
# Wait for confirmation (~10 min)
wait_for_confirmations(txid, 1)
3. Staging (Testnet)
# Full integration before mainnet
def test_production_flow():
# Test against testnet services
# Verify third-party integrations
# Load testing
Best Practices
Do
- ✅ Always start development on regtest
- ✅ Use signet for realistic testing
- ✅ Test edge cases (reorgs, failures)
- ✅ Keep testnet/mainnet code paths separate
- ✅ Return testnet coins to faucets when done
Don’t
- ❌ Never test with real BTC
- ❌ Don’t assume testnet stability
- ❌ Don’t hardcode network parameters
- ❌ Don’t rely on testnet for production checks
Configuration Examples
JavaScript (bitcoinjs-lib)
const bitcoin = require('bitcoinjs-lib');
// Mainnet (default)
const mainnet = bitcoin.networks.bitcoin;
// Testnet
const testnet = bitcoin.networks.testnet;
// Regtest
const regtest = bitcoin.networks.regtest;
// Use network
const address = bitcoin.payments.p2wpkh({
pubkey: publicKey,
network: testnet
}).address;
Python (python-bitcoinlib)
from bitcoin import SelectParams
# Select network
SelectParams('testnet') # or 'mainnet', 'regtest'
Machine-Readable Summary
{
"topic": "bitcoin-test-networks",
"networks": {
"testnet": {
"prefix_bech32": "tb",
"api": "https://mempool.space/testnet/api"
},
"signet": {
"prefix_bech32": "tb",
"api": "https://mempool.space/signet/api"
},
"regtest": {
"prefix_bech32": "bcrt",
"local_only": true
}
},
"faucets": {
"testnet": ["https://coinfaucet.eu/en/btc-testnet/"],
"signet": ["https://signetfaucet.com/"]
}
}