Skip to content

Instantly share code, notes, and snippets.

@Danilo-Araujo-Silva
Last active April 27, 2021 14:45
Show Gist options
  • Select an option

  • Save Danilo-Araujo-Silva/9dec9b83b3c22ab55049f9ede3f8ef6c to your computer and use it in GitHub Desktop.

Select an option

Save Danilo-Araujo-Silva/9dec9b83b3c22ab55049f9ede3f8ef6c to your computer and use it in GitHub Desktop.
full configuration for bitcoind with regtest and docker
regtest=1
[regtest]
debug=1
server=1
rpcallowip=0.0.0.0/0
rpcbind=127.0.0.1
rpcbind=bitcoind-regtest-01
rpcauth=<rpcuser>:<rpc auth line created by https://github.com/bitcoin/bitcoin/tree/c7ad94428ab6f54661d7a5441e1fdd0ebf034903/share/rpcauth>
# Used for inspecting transactions
txindex=1
regtest=1
[regtest]
debug=1
server=1
rpcallowip=0.0.0.0/0
rpcbind=127.0.0.1
rpcbind=bitcoind-regtest-02
rpcauth=<rpc auth line created using https://github.com/bitcoin/bitcoin/tree/c7ad94428ab6f54661d7a5441e1fdd0ebf034903/share/rpcauth>
# Using different ports from the previous container
# The default ones are: 18443 (rpcport), 18444 (port)
rpcport=18445
port=18446
connect=<first container ip, fetched from the docker network>:18444
1- Create two different docker containers (there are bitcoin.conf examples below) `bitcoind-regtest-01` and `bitcoind-regtest-02`
pointing to different data folders (The regtest network will only work with at least 2 nodes).
- `bitcoind -conf=/path/to/bitcoind-regtest-01/bitcoin.conf -datadir=/path/to/bitcoind-regtest-01/data/folder -daemon`
- `bitcoind -conf=/path/to/bitcoind-regtest-02/bitcoin.conf -datadir=/path/to/bitcoind-regtest-02/data/folder -daemon`
2- Create a docker network with the 2 containers
- `docker network create bitcoind-regtest-network`
- `docker network connect bitcoind-regtest-network bitcoind-regtest-01`
- `docker network connect bitcoind-regtest-network bitcoind-regtest-02`
3- Get the ip address of the `bitcoind-regtest-01` container in the network and change the `bitcoind-regtest-02` `bitcoin.conf`
accordingly (since the `bitcoind-regtest-02` node should be connecting to `bitcoind-regtest-01`). If this step is not done
the `getblocktemplate` method will not work.
- `docker network inspect bitcoind-regtest-network`
4- Start the containers, observe the logs and check if there are no connection problems there
5- From the host machine export the RPC user and password for testing purposes:
`export RPC_USER_PASS="<rpc user>:<rpc password>"`
6- Check if it is working:
7- TODO Complete the documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment