Links
Comment on page

MiniBolt on Testnet

You can run your MiniBolt node on testnet to develop and experiment with new applications, without putting real money at risk. This bonus guide highlights all configuration changes compared to the main guide.
Difficulty: Medium

Introduction

Running a testnet node is a great way to get acquainted with the MiniBolt and the suite of Bitcoin-related software typical of these powerful setups. Moreover, testnet empowers users to tinker with the software and its many configurations without the threat of losing funds. Helping bitcoiners run a full testnet setup is a goal worthy of the MiniBolt, and this page should provide you with the knowledge to get there.
The great news is that most of the MiniBolt guide can be used as-is. The small adjustments come in the form of changes to the config files and ports for testnet. You can follow the guide and simply replace the following configurations in the right places as you go.
Advice:
For the moment, this guide will touch only the case of an only testnet mode situation, in the future, we will study adding the case of configuration to enable the parallel/simultaneous mode (mainnet+testnet in the same device) in an extra section in this guide.
The services mentioned in this guide are those that have been tested using testnet configuration and these worked fine. Later, in the next versions of this guide, we will go to adding other process to adapt other services to the testnet mode.

Bitcoin

$ nano /home/bitcoin/.bitcoin/bitcoin.conf
## Replace the parameter
startupnotify=chmod g+r /home/bitcoin/.bitcoin/testnet3/.cookie
## Add the parameter
testnet=1
  • When you finish the Running Bitcoin section, with the user admin provide read and execute permissions to the Bitcoin group for the testnet folder
$ sudo chmod g+rx /data/bitcoin/testnet3
Attention: the step before is important! to allow LND to access to the .cookie file and startup without problems
The rest of the Bitcoin client guide is exactly the same as the mainnet mode. Note that the seeds nodes of the "Reject non-privacy networks" section will be different, being correct those on this list. Only exist Tor seed nodes, not clearnet or I2P nodes.
Follow the complete Electrum server guide from the beginning, when you arrive at the "Configure Firewall" section:
  • Replace the next lines to 60001/60002 ports, to match with the Testnet mode
$ sudo ufw allow 60001/tcp comment 'allow Fulcrum Testnet TCP from anywhere'
$ sudo ufw allow 60002/tcp comment 'allow Fulcrum Testnet SSL from anywhere'
  • When you arrive at the "Data directory" section on the "Download the custom Fulcrum banner based on MiniBolt..." step. Download the Fulcrum testnet banner instead of the mainnet banner
$ wget https://raw.githubusercontent.com/minibolt-guide/minibolt/main/resources/fulcrum-banner-testnet.txt
  • In the next Configuration step, stay tuned to replace the next lines on the "fulcrum.conf" file, to match with the testnet mode
$ nano /data/fulcrum/fulcrum.conf
# Bitcoin Core settings
bitcoind = 127.0.0.1:18332
rpccookie = /data/bitcoin/testnet3/.cookie
# Fulcrum server general settings
ssl = 0.0.0.0:60002
tcp = 0.0.0.0:60001
# Banner
banner = /data/fulcrum/fulcrum-banner-testnet.txt
$ sudo nano /etc/tor/torrc
  • Replace ports to 60001/60002 to match with testnet mode
############### This section is just for location-hidden services ###
# Hidden Service Fulcrum Testnet TCP & SSL
HiddenServiceDir /var/lib/tor/hidden_service_fulcrum_testnet_tcp_ssl/
HiddenServiceVersion 3
HiddenServicePoWDefensesEnabled 1
HiddenServicePort 60001 127.0.0.1:60001
HiddenServicePort 60002 127.0.0.1:60002
  • Reload the Tor configuration and get your connection addresses
$ sudo systemctl reload tor
$ sudo cat /var/lib/tor/hidden_service_fulcrum_testnet_tcp_ssl/hostname
Example of expected output:
> abcdefg..............xyz.onion
You should now be able to connect to your Fulcrum server remotely via Tor using your hostname and port 60001 (TCP) or 60002 (SSL)
The rest of the Fulcrum guide is exactly the same as the mainnet mode
  • Follow the complete guide from the beginning, when you arrive at the Configuration section, set the next lines with the next values instead of the existing ones for mainnet. Edit .env file
$ nano /home/btcrpcexplorer/btc-rpc-explorer/.env
BTCEXP_BITCOIND_PORT=18332
BTCEXP_BITCOIND_COOKIE=/data/bitcoin/testnet3/.cookie
BTCEXP_ELECTRUM_SERVERS=tcp://127.0.0.1:60001
The rest of the BTC RPC Explorer guide is exactly the same as the mainnet mode

Lightning

  • Follow the complete guide from the beginning, when you arrive at the Configuration section, edit lnd.conf
$ nano /data/lnd/lnd.conf
  • Replace the parameter "bitcoin.mainnet=true" with the "bitcoin.testnet=true" to enable LND in testnet mode
[Bitcoin]
bitcoin.testnet=true
  • When you arrive at the Create systemd service section, edit the lnd.service file and replace ExecStop parameter to this
ExecStop=/usr/local/bin/lncli --network=testnet stop
When you arrive at the Watchtower client section, keep in mind that the Watchtower server suggested won't work with the LND testnet, same with the LND mainnet peer suggested to open the channel and send a payment
Interacting with the LND daemon
  • Note that when interacting with the LND daemon, you'll need to use the "--network testnet" flag
$ lncli --network testnet walletbalance
Note that it has a list of testnet aliases related to these commonly used commands to make it easier to introduce in the terminal. Follow the "Aliases bonus guide" to install it
The rest of the Lightning Client guide is exactly the same as the mainnet mode
  • Follow the complete guide from the beginning, when you arrive at the "Create script" section, create the script
$ sudo nano /usr/local/bin/scb-backup --linenumbers
  • Replace the line 18 in the script to match with the testnet path
SCB_SOURCE_FILE="/data/lnd/data/chain/bitcoin/testnet/channel.backup"
If you have a mainnet node running on another device and you want to use the same GitHub account for the channel backups:
  • Change this line on the script to this for example: REMOTE_BACKUP_DIR="/data/lnd/remote-lnd-testnet-backup"
  • When you arrive at the "Create a GitHub repository" section, change the name of the GitHub repo to for example: "remote-lnd-testnet-backup"
  • When you arrive at the "Clone the repository to your node" section, replace the command with: $ git clone [email protected]:<YourGitHubUsername>/remote-lnd-testnet-backup.git
  • When you arrive at the "GitHub test" section, replace the command to: $ cd remote-lnd-testnet-backup
The rest of the Channel Backup guide is exactly the same as the mainnet mode
  • Follow the complete guide from the beginning, when you arrive at the Configuration section, replace the next parameter to match with the testnet mode on the .env.local file
MEMPOOL_URL='https://mempool.space/testnet'
  • And replace the next parameter on the thubConfig.yaml file
macaroonPath: /data/lnd/data/chain/bitcoin/testnet/admin.macaroon
The rest of the Web app: Thunderhub is exactly the same as the mainnet mode
  • Follow the complete guide from the beginning, when you arrive at the Create a lndconnect QR code section, add to the "lndconnect" command the next flags
$ --bitcoin.testnet --adminmacaroonpath=/home/admin/.lnd/data/chain/bitcoin/testnet/admin.macaroon
For example, to generate a QR code for a Wireguard VPN connection, enter this command:
$ lndconnect --host=10.0.0.1 --port=8080 --bitcoin.testnet --adminmacaroonpath=/home/admin/.lnd/data/chain/bitcoin/testnet/admin.macaroon

Bonus section

Bitcoin

Electrs

Follow the complete guide from the beginning, when you arrive at the "Firewall & reverse proxy section", follow next steps
  • Configure the Firewall to allow incoming requests
$ sudo ufw allow 60002/tcp comment 'allow Electrs SSL from anywhere'
$ sudo ufw allow 60001/tcp comment 'allow Electrs TCP from anywhere'
  • Create the electrs-reverse-proxy.conf file
$ sudo nano /etc/nginx/streams-enabled/electrs-reverse-proxy.conf
  • Replace the mainnet ports (50001/50002) with the 60001/60001 testnet ports
upstream electrs {
server 127.0.0.1:60001;
}
server {
listen 60002 ssl;
proxy_pass electrs;
}
  • Test and reload NGINX configuration
$ sudo nginx -t
$ sudo systemctl reload nginx
  • When you arrive at the Configuration section, replace it with the next lines
$ nano /data/electrs/electrs.conf
# MiniBolt: electrs testnet configuration
# /data/electrs/electrs.conf
# Bitcoin Core settings
network = "testnet"
cookie_file = "/data/bitcoin/testnet3/.cookie"
skip_block_download_wait = true
# Electrs settings
electrum_rpc_addr = "0.0.0.0:60001"
server_banner = "Welcome to electrs (Electrum Rust Server) running on a MiniBolt node testnet!"
$ sudo nano /etc/tor/torrc
  • Edit torrc and replace ports to 60001/60002 to match with testnet mode
# Hidden Service Electrs Testnet TCP & SSL
HiddenServiceDir /var/lib/tor/hidden_service_electrs_testnet_tcp_ssl/
HiddenServiceVersion 3
HiddenServicePoWDefensesEnabled 1
HiddenServicePort 60001 127.0.0.1:60001
HiddenServicePort 60002 127.0.0.1:60002
  • Reload the Tor configuration and get your connection addresses
$ sudo systemctl reload tor
$ sudo cat /var/lib/tor/hidden_service_electrs_testnet_tcp_ssl/hostname
Example of expected output:
> abcdefg..............xyz.onion
The rest of the Channel Backup guide is exactly the same as the mainnet mode