Wednesday, 23 May 2018

Setup and test bitcoind using regtest on two nodes

# On machine A, edit bitcoin.conf in /home/ubuntu/alice
regtest = 1
server = 1
port=18332
rpcport = 18333
rpcuser=bitcoinrpc
rpcpassword=password
rpcallowip=0.0.0.0/0

# execute bitcoind
ubuntu@ip-11-0-0-110:~$ bitcoind -conf=/home/ubuntu/alice/bitcoin.conf -datadir=/home/ubuntu/alice -daemon
Bitcoin server starting

# On machine B, edit bitcoin.conf in /home/ubuntu/alice (machine B connect to machine A)
regtest = 1
server = 1
port=18443
rpcport = 18444
connect = 11.0.0.110:18332
rpcuser=bitcoinrpc
rpcpassword=password

# execute bitcoind
ubuntu@ip-10-0-0-55:~$ bitcoind -conf=/home/ubuntu/alice/bitcoin.conf -datadir=/home/ubuntu/alice -daemon
Bitcoin server starting

# execute the command on either machine A or machine B, they will see the same information
ubuntu@ip-11-0-0-110:~$ bitcoin-cli -conf=/home/ubuntu/alice/bitcoin.conf -datadir=/home/ubuntu/alice/  getinfo
{
  "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16",
  "version": 150100,
  "protocolversion": 70015,
  "walletversion": 139900,
  "balance": 0.00000000,
  "blocks": 101,
  "timeoffset": 0,
  "connections": 1,
  "proxy": "",
  "difficulty": 4.656542373906925e-10,
  "testnet": false,
  "keypoololdest": 1521075913,
  "keypoolsize": 2000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

ubuntu@ip-11-0-0-110:~$ bitcoin-cli -conf=/home/ubuntu/alice/bitcoin.conf -datadir=/home/ubuntu/alice/  getconnectioncount
1