I am using https://github.com/freewil/bitcoin-testnet-box to run bitcoind in docker to test signing of transactions.
make start
tells me the bitcoind is started without -regtest
flag. See https://github.com/freewil/bitcoin-testnet-box/blob/master/Makefile#L13
When I run bitcoin-cli -datadir=1 getblockchaininfo
, I indeed see "chain": "regtest"
in output, so both the nodes are running in regression test mode, I believe.
If I generate an address for either of these 2 nodes, I get an address starting with 2:
tester@4df64413049e ~/bitcoin-testnet-box$ make address1
bitcoin-cli -datadir=1 getnewaddress
2N4DTeBWDF9yaF9TJVGcgcZDM7EQtsGwFjX
tester@4df64413049e ~/bitcoin-testnet-box$ make address2
bitcoin-cli -datadir=2 getnewaddress
2MwxP8fyh9MFqKnZXZuqt3ZYByhLpNVoiX3
make getinfo
tells me its not testnet either:
tester@4df64413049e ~/bitcoin-testnet-box$ make getinfo
bitcoin-cli -datadir=1 -getinfo
{
"version": 170100,
"protocolversion": 70015,
"walletversion": 169900,
"balance": 0.00000000,
"blocks": 0,
"timeoffset": 0,
"connections": 1,
"proxy": "",
"difficulty": 4.656542373906925e-10,
"testnet": false,
"keypoololdest": 1599940906,
"keypoolsize": 1000,
"paytxfee": 0.00000000,
"relayfee": 0.00001000,
"warnings": ""
}
bitcoin-cli -datadir=2 -getinfo
{
"version": 170100,
"protocolversion": 70015,
"walletversion": 169900,
"balance": 0.00000000,
"blocks": 0,
"timeoffset": 0,
"connections": 1,
"proxy": "",
"difficulty": 4.656542373906925e-10,
"testnet": false,
"keypoololdest": 1599940906,
"keypoolsize": 1000,
"paytxfee": 0.00000000,
"relayfee": 0.00001000,
"warnings": ""
}
So what mode I am running these bitcoin nodes as? If I was to trust the output that its not testmode but somehow regression test mode, shouldn't the address start with 1 if its really regtest mode or with m/n if its testnet mode?
Also, when I dump the private key for any of such address and try to derive the P2PKH address from it, it doesn't match. Same code works fine with address and key taken from mainnet. What's going on?