Node operation and maintenance

The Devops documentation.

Node O&M Documentation

Trust self-built Bitcoin full node reference

It is recommended that the trust node use the Bitcoin full node built by itself. The recommended machine configuration is not lower than: CPU 2 cores, memory 4G, SSD hard disk 500G.

Download the latest version of bitcoin binary package

Download the latest bitcoin binary package directly at bitcoin.org (or download the latest bitcoin package directly through the distribution’s package manager), unzip it and create a soft link

# Specify the download directory
$ cd /opt
# download
$ wget https://bitcoin.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
# decompress
$ tar zxvf bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
# Create soft links
$ ln -fs /opt/bitcoin-0.20.1 /opt/bitcoin
$ ln -fs /opt/bitcoin-0.20.1/bin/bitcoind /usr/local/bin/bitcoind
$ ln -fs /opt/bitcoin-0.20.1/bin/bitcoin-cli /usr/local/bin/bitcoin-cli

Create the specified data and wallets directories

Or use the default paths ~/.bitcoin/data and ~/.bitcoin/wallets

$ mkdir -p /mnt/bitcoin-mainnet/data
$ mkdir -p /mnt/bitcoin-mainnet/wallets

Create configuration file

Or use the default path ~/.bitcoin/bitcoin.conf

$ touch /mnt/bitcoin-mainnet/bitcoin.conf
$ vim /mnt/bitcoin-mainnet/bitcoin.conf
# Generated by https://jlopp.github.io/bitcoin-core-config-generator/

# [core]
# Set database cache size in megabytes; machines sync faster with a larger cache.
# Recommend setting as high as possible based upon machine's available RAM.
dbcache=4096

# Keep the transaction memory pool below <n> megabytes.
maxmempool=256

# Do not keep transactions in the mempool longer than <n> hours.
mempoolexpiry=12

# Maintain a full transaction index, used by the getrawtransaction rpc call.
txindex=1

# [network]

# [debug]
# Enable debug logging for all categories.
#debug=1

# Log IP Addresses in debug output.
logips=1

# Log timestamps with microsecond precision.
logtimemicros=1

# [relay]
# Maximum size of data in OP_RETURN outputs we relay and mine.
datacarriersize=82

# Fee rates (in BTC/kB) smaller than this are considered zero fee for relaying, mining and transaction creation.
minrelaytxfee=0.000001

# [mining]
# Set lowest fee rate (in BTC/kB) for transactions to be included in block creation.
blockmintxfee=0.000001

# [rpc]
# Enable Accounts RPC
deprecatedrpc=accounts

# Accept command line and JSON-RPC commands.
server=1
# Accept public REST requests.
rest=1

# Username and hashed password for JSON-RPC connections.
# The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>.
# RPC clients connect using rpcuser=<USERNAME>/rpcpassword=<PASSWORD> arguments.
# You can generate this value with the share/rpcauth/rpcauth.py script in the Bitcoin Core repository.
# This option can be specified multiple times.
rpcuser=Authenticated users for remote access
rpcpassword=Remote access password

# Allow JSON-RPC connections from specified source.
# Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).
# This option can be specified multiple times.
# IP or network segment for remote access It is recommended to specify the IP range, and unfamiliar IP access is not allowed
rpcallowip=0.0.0.0/0

# Set the number of threads to service RPC calls
rpcthreads=16

# [wallet]

# [Sections]
# Most options automatically apply to mainnet, testnet, and regtest networks.
# If you want to confine an option to just one network, you should add it in the relevant section.
# EXCEPTIONS: The options addnode, connect, port, bind, rpcport, rpcbind and wallet
# only apply to mainnet unless they appear in the appropriate section below.

# Options only for mainnet
[main]
# [core]
# Specify a non-default location to store blockchain data.
blocksdir=/mnt/bitcoin-mainnet/data
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/bitcoin-mainnet/data

# [network]
# Listen for incoming connections on non-default port.
port=8333

# [debug]
# Location of the debug log
debuglogfile=/mnt/bitcoin-mainnet/data/debug.log

# [rpc]
# Bind to given address to listen for JSON-RPC connections.
# This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6.
# This option can be specified multiple times. (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)
rpcbind=0.0.0.0
# Listen for JSON-RPC connections on this port
rpcport=8332

# [wallet]
# Specify a non-default location to store wallet data.
walletdir=/mnt/bitcoin-mainnet/wallets

# Options only for testnet
[test]

# Options only for regtest
[regtest]

Starting and Stopping a Bitcoin Full Node

# start up
$ bitcoind -conf=/mnt/bitcoin-mainnet/bitcoin.conf -daemon
# stop
$ bitcoin-cli -conf=/mnt/bitcoin-mainnet/bitcoin.conf stop

Test bitcoin node rpc service

$ curl -s -X POST --user rpcuser:rpcpassword -H 'content-type: text/plain;' http://127.0.0.1:8332/ --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }'

Import trust hot and cold multi-signature addresses

Import the trust hot and cold multi-signature address into the wallet. Whenever the trust is replaced or the trust hot and cold multi-signature address is changed, the operation and maintenance personnel need to import the new address into the wallet, so that the trust node can obtain it when using ChainX Wallet to construct a withdrawal transaction. A list of UTXOs for this address. The import command is as follows:

$ bitcoin-cli -conf=/mnt/bitcoin-mainnet/bitcoin.conf importaddress bitcoin address "" true
Last modified April 24, 2022: update (e735fd1)