BTQ Docs
Mining

Testnet Mining Guide

Complete guide for setting up your BTQ wallet, running a node, and connecting to the mining pool on the BTQ testnet.

Testnet Mining Guide

Complete guide for setting up your BTQ wallet, running a node, and connecting to the mining pool.

Testnet quick reference:

  • RPC port: 18332 — used by btq-cli and applications to talk to your node
  • P2P port: 19333 — open this in your firewall to accept incoming peers
  • Data directory: ~/.btq/test/ — logs, wallet, and blockchain data
  • CLI flag: always pass -testnet to btqd and btq-cli

This guide builds on the Installation and Wallet Basics sections. Make sure you have BTQ Core built and installed before proceeding.


Prerequisites

Required Software

  • BTQ Core daemon (btqd and btq-cli) — see Installation for build instructions and system requirements, or latest releases linked below.
  • BTQ-CCMiner (ccminer) — available from the latest BTQ Releases.
  • Access to a BTQ mining pool — the public testnet pool is at pool.bitcoinquantum.com.

After downloading the binaries, you must change the file permissions to make them executable using chmod +x. See the Installation guide for details.

System Requirements

  • Linux/WSL or UNIX environment (including macOS)
  • NVIDIA GPU with CUDA 11 support (for GPU mining)

For full system requirements (RAM, disk, CPU), refer to the Installation page.


Starting BTQ Daemon

1. Create Configuration Directory

Create the BTQ data directory where configuration and blockchain data will be stored:

mkdir -p ~/.btq

2. Create Configuration File

Create the BTQ configuration file at ~/.btq/btq.conf:

cat > ~/.btq/btq.conf << EOF
# BTQ Configuration File

# Global settings
server=1
daemon=1

# Testnet-specific settings
[test]
rpcuser=btquser
rpcpassword=btqpass123
rpcallowip=127.0.0.1
rpcport=18332
rpcbind=127.0.0.1
port=19333
listen=1
gen=0
maxconnections=50
EOF

Mainnet Configuration

cat > ~/.btq/btq.conf << EOF
# RPC Settings
server=1
rpcuser=btquser
rpcpassword=btqpass123
rpcallowip=127.0.0.1
rpcbind=127.0.0.1

# Network Settings
listen=1

# Other Settings
daemon=1
EOF

Security Note: Change rpcuser and rpcpassword to strong, unique values in production! See the configuration section in Installation for more guidance on securing your node.

If you already maintain a btq.conf (for example from the Installation guide), add or adjust the [test] block instead of overwriting the entire file.

3. Start BTQ Daemon

Navigate to your BTQ Core directory and start the daemon:

For Testnet:

./btqd -daemon -testnet

For Mainnet:

./btqd -daemon

For Regtest (Local Testing):

./btqd -daemon -regtest

See the Running Modes section in Installation for more details on each network mode.

4. Verify Daemon is Synced & Running

Confirm the daemon is in sync with the blockchain network:

# Check blockchain info
./btq-cli -testnet getblockchaininfo

# Check network info
./btq-cli -testnet getnetworkinfo

# View debug log
tail -f ~/.btq/test/debug.log

Use the debug log to watch for peer connections and stratum-related messages.


Creating a Wallet

For a comprehensive overview of wallet management, encryption, and key storage, refer to Wallet Basics. This section covers the essentials for creating a mining-focused wallet.

1. Create a New Wallet

For Testnet:

./btq-cli -testnet createwallet "dilithium_wallet"

For Mainnet:

./btq-cli createwallet "my_mining_wallet"

Expected output:

{
  "name": "dilithium_wallet"
}

2. Verify Wallet Creation

# List all wallets
./btq-cli -testnet listwallets

# Get wallet info
./btq-cli -testnet -rpcwallet=dilithium_wallet getwalletinfo

3. Backup Your Wallet

# Backup wallet file
cp ~/.btq/test/wallets/dilithium_wallet/wallet.dat ~/wallet_backup_$(date +%Y%m%d).dat

# Or use built-in backup
./btq-cli -testnet -rpcwallet=dilithium_wallet backupwallet ~/wallet_backup.dat

CRITICAL: Store this backup in a secure location. Loss of this file means loss of funds! See the Backup section in Wallet Basics for detailed guidance on wallet backups and key storage.


Generating Mining Address

BTQ supports quantum-resistant Dilithium addresses. These are recommended for mining. For a full overview of Dilithium address types, key management, and import/export, see Wallet Basics — Generating Dilithium Addresses.

If you restarted the daemon since creating your wallet, load it first with your wallet.dat:

./btq-cli -testnet loadwallet "dilithium_wallet"

Use getnewdilithiumaddress with no arguments. As of v0.4.2-testnet it returns a P2MR (BIP360, witness v2) address — the single supported Dilithium receive type and the correct mining payout target. See Dilithium Addresses for the full format.

For Testnet:

./btq-cli -testnet -rpcwallet=dilithium_wallet getnewdilithiumaddress

For Mainnet:

./btq-cli -rpcwallet=my_mining_wallet getnewdilithiumaddress

This RPC returns a JSON object, not a bare address string. Piping it straight into a file or a shell variable captures the whole object — extract the address field:

./btq-cli -testnet -rpcwallet=dilithium_wallet getnewdilithiumaddress | jq -r '.address'

Response shape:

{
  "address": "tbtq1z...",
  "p2mr_id": "...",
  "scriptPubKey": "...",
  "merkle_root": "..."
}

P2MR addresses are Bech32m with witness version 2, so they read qbtc1z… on mainnet and tbtq1z… on testnet — the 1z distinguishes them at a glance from ECDSA 1q SegWit addresses.

Do not pass "legacy" or "bech32". Since v0.4.2 the only accepted address_type is "p2mr"; anything else is rejected. Older guides showing getnewdilithiumaddress "" "legacy" or getnewaddress "" "dilithium-bech32" refer to formats that are now historical or disabled.

Other Address Types

Legacy (Standard Bitcoin-style):

./btq-cli -rpcwallet=my_mining_wallet getnewaddress "" "legacy"

Bech32 (Native SegWit):

./btq-cli -rpcwallet=my_mining_wallet getnewaddress "" "bech32"

Save Your Address

# Export to a file for safekeeping (extract the address field)
./btq-cli -testnet -rpcwallet=dilithium_wallet getnewdilithiumaddress \
  | jq -r '.address' > ~/my_btq_mining_address.txt

# View your address
cat ~/my_btq_mining_address.txt

This is where your mining rewards will be sent. Keep it safe!

Verify Address Ownership

Confirm the address belongs to your wallet before mining:

./btq-cli -testnet -rpcwallet=dilithium_wallet getaddressinfo YOUR_ADDRESS

Connecting to Mining Pool

Mining Pool Details

DetailValue
Pool Address65.20.111.197
Port3333

1. Prepare CCMiner

# Change permissions to executable
chmod +x ./ccminer

# Install prerequisites (if needed)
sudo apt-get update
sudo apt-get install -y libjansson4

2. Connect to Mining Pool

Basic Command:

./ccminer -a sha256d \
  -o stratum+tcp://POOL_IP:PORT \
  -u YOUR_BTQ_ADDRESS \
  -p x

Example with Actual Values:

./ccminer -a sha256d \
  -o stratum+tcp://65.20.111.197:3333 \
  -u n5KchJ9AJaiHRkLpKF7Bx8dbjsgt1CZdC4 \
  -p x

3. Expected Output

When successfully connected, you should see:

*** ccminer 2.3.1 for nVidia GPUs by tpruvot@github ***
    Built with the nVidia CUDA Toolkit 11.5 64-bits

[2025-11-24 12:06:48] Starting on stratum+tcp://65.20.111.197:3333
[2025-11-24 12:06:48] NVML GPU monitoring enabled.
[2025-11-24 12:06:48] 1 miner thread started, using 'sha256d' algorithm.
[2025-11-24 12:06:49] Stratum difficulty set to 0.01
[2025-11-24 12:06:49] GPU #0: Intensity set to 25, 33554432 cuda threads
[2025-11-24 12:06:50] GPU #0: NVIDIA GeForce RTX 3090 Ti, 4196.47 MH/s
[2025-11-24 12:06:52] accepted: 1/1 (diff 2.369), 4207.80 MH/s yay!!!

4. Advanced CCMiner Options

Use Specific GPU:

./ccminer -a sha256d \
  -o stratum+tcp://65.20.111.197:3333 \
  -u YOUR_ADDRESS \
  -p x \
  -d 0  # Use GPU 0

Adjust Intensity (0-31):

./ccminer -a sha256d \
  -o stratum+tcp://65.20.111.197:3333 \
  -u YOUR_ADDRESS \
  -p x \
  -i 25  # Intensity 25

Run in Background:

nohup ./ccminer -a sha256d \
  -o stratum+tcp://65.20.111.197:3333 \
  -u YOUR_ADDRESS \
  -p x > miner.log 2>&1 &

Stop background miners with pkill ccminer.


Monitoring Your Mining

Check Wallet Balance

# Check total balance
./btq-cli -testnet -rpcwallet=dilithium_wallet getbalance

# Check unconfirmed balance
./btq-cli -testnet -rpcwallet=dilithium_wallet getunconfirmedbalance

# List recent transactions
./btq-cli -testnet -rpcwallet=dilithium_wallet listtransactions

For more wallet operations such as sending transactions and message signing, refer to Wallet Basics.

Understanding Mining Output

MetricDescription
MH/sMega-hashes per second (your mining speed)
acceptedNumber of valid shares submitted
diffCurrent difficulty level
yay!!!Successfully found a share/block

Check Network Status

# Current block height
./btq-cli -testnet getblockcount

# Connection count
./btq-cli -testnet getconnectioncount

# Peer info
./btq-cli -testnet getpeerinfo

Troubleshooting

Daemon Won't Start

# Check if already running
ps aux | grep btqd

# Kill existing process
killall btqd

# Check debug log for errors
tail -100 ~/.btq/debug.log

# Start with verbose logging
./btqd -daemon -debug

See the Troubleshooting section in Installation for additional build and runtime error guidance.

Can't Connect to Mining Pool

# Test connectivity
ping 65.20.111.197
telnet 65.20.111.197 3333

# Check firewall (if running pool)
sudo ufw status
sudo ufw allow 3333/tcp

Ensure local firewalls permit outbound TCP/3333.

Wrong Network Mode

# Check current chain
./btq-cli getblockchaininfo | grep chain

# Stop daemon
./btq-cli stop

# Start in correct mode
./btqd -daemon              # Mainnet
./btqd -daemon -testnet     # Testnet
./btqd -daemon -regtest     # Regtest

RPC Authentication Errors

# Stop daemon
./btq-cli stop

# Edit config and fix credentials
nano ~/.btq/btq.conf

# Restart with explicit credentials
./btqd -daemon -rpcuser=btquser -rpcpassword=btqpass123

Low Mining Performance

# Check GPU usage
nvidia-smi

# Check thermal throttling
nvidia-smi -q -d TEMPERATURE

# Increase intensity (try 25-28)
./ccminer -a sha256d -o ... -i 28

Verify thermals and try higher intensity values gradually.


Mining Workflow

1. Confirm Node Readiness

Build and sync btqd using the Installation guide, then verify you can query getblockchaininfo.

2. Prepare Payout Wallet

Use Wallet Basics to create a Dilithium-enabled wallet and record the mining address.

3. Launch the Miner

Point ccminer at stratum+tcp://65.20.111.197:3333 with your address and chosen GPU settings.

4. Monitor Rewards

Watch miner.log, wallet balances, and debug logs to confirm accepted shares and payouts.


Quick Reference

Network Ports

NetworkP2P PortRPC PortAddress Prefix
Mainnet93338332b, D, dbtc
Testnet1933318332n, tdbt
Regtest1944418443n, rdbt

Common Commands

Wallet Operations:

# Create wallet
./btq-cli -testnet createwallet "wallet_name"

# Generate dilithium address (P2MR; returns a JSON object)
./btq-cli -testnet -rpcwallet=wallet_name getnewdilithiumaddress | jq -r '.address'

# Check balance
./btq-cli -testnet -rpcwallet=wallet_name getbalance

# List transactions
./btq-cli -testnet -rpcwallet=wallet_name listtransactions

# Backup wallet
./btq-cli -testnet -rpcwallet=wallet_name backupwallet ~/backup.dat

Mining Operations:

# Start mining
./ccminer -a sha256d -o stratum+tcp://POOL:3333 -u ADDRESS -p x

# Mine in background
nohup ./ccminer -a sha256d -o stratum+tcp://POOL:3333 -u ADDRESS -p x > miner.log 2>&1 &

# Check mining log
tail -f miner.log

# Stop background miner
pkill ccminer

Node Operations:

# Start daemon
./btqd -daemon -testnet

# Stop daemon
./btq-cli -testnet stop

# Get blockchain info
./btq-cli -testnet getblockchaininfo

# Get network info
./btq-cli -testnet getnetworkinfo

# View log
tail -f ~/.btq/test/debug.log

Key Mining Pool Details

ItemValue
Pool endpointstratum+tcp://65.20.111.197:3333
Testnet RPC127.0.0.1:18332
Testnet P2P0.0.0.0:19333 (listening)
Recommended address typeDilithium (legacy)
Background miner log~/miner.log

Security Best Practices

  1. Backup Your Wallet: Always keep encrypted backups in multiple locations. See Wallet Basics — Backup for details.
  2. Secure RPC: Use strong passwords and restrict RPC access to localhost.
  3. Firewall: Only open necessary ports (pool ports, P2P if running full node).
  4. Keep Private Keys Secure: Never share wallet.dat or private keys.
  5. Update Regularly: Keep BTQ Core and mining software up to date.
  6. Monitor Access: Regularly check logs for unauthorized access attempts.

Need Help?

Join the BTQ Telegram community to get support, report bugs, and connect with other miners.

On this page