0

I'm using bitcoin core 22.0 to start two nodes in two different containers in the same VMware ubuntu18.04, with network mode using Host-Only(I will talk about the reason later).

What my aim to do so is to set up a private blockchain locally, just for experiment, but regtest and custom signet didn't serve my purpose, because the difficulty on regtest is too low and signet needs extra signer to sign blocks. So I use off-line testnet3(with -dnsseed=0, no syncing from the internet) to link the above two nodes to set up a small bitcoin network locally.

What my problem is When I use the command bitcoin-cli -conf=/data/bitcoin/bitcoin.conf addnode "172.17.0.3:18002" onetry to set a p2p connection one node1, the node1 didn't sync header,blocks,etc from the node it connected. I'm new to bitcoin core and I'm so CONFUSED. Hope anyone could help so solve this problem. Thanks a lot in advance. I will put my config file below.

Start noed1

# bitcoind -conf=/data/bitcoin/bitcoin.conf -datadir=/data/bitcoin -dnsseed=0

bitcoin.conf of node1

testnet=1
[test]
rpcuser=test1
rpcpassword=test1
rpcbind=0.0.0.0
rpcport=18332
rpcallowip=127.0.0.1
server=1
port=18001
listen=1

what the node1 output:

2022-07-21T04:44:42Z Bitcoin Core version v22.0.0 (release build)
2022-07-21T04:44:42Z Assuming ancestors of block 0000000000004ae2f3896ca8ecd41c460a35bf6184e145d91558cece1c688a76 have valid signatures.
2022-07-21T04:44:42Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000005180c3bd8290da33a1a
2022-07-21T04:44:42Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2022-07-21T04:44:42Z Using RdSeed as additional entropy source
2022-07-21T04:44:42Z Using RdRand as an additional entropy source
2022-07-21T04:44:42Z Default data directory /root/.bitcoin
2022-07-21T04:44:42Z Using data directory /data/bitcoin/testnet3
2022-07-21T04:44:42Z Config file: /data/bitcoin/bitcoin.conf
2022-07-21T04:44:42Z Config file arg: testnet="1"
2022-07-21T04:44:42Z Config file arg: [test] listen="1"
2022-07-21T04:44:42Z Config file arg: [test] port="18001"
2022-07-21T04:44:42Z Config file arg: [test] rpcallowip="127.0.0.1"
2022-07-21T04:44:42Z Config file arg: [test] rpcbind=****
2022-07-21T04:44:42Z Config file arg: [test] rpcpassword=****
2022-07-21T04:44:42Z Config file arg: [test] rpcport="18332"
2022-07-21T04:44:42Z Config file arg: [test] rpcuser=****
2022-07-21T04:44:42Z Config file arg: [test] server="1"
2022-07-21T04:44:42Z Command-line arg: conf="/data/bitcoin/bitcoin.conf"
2022-07-21T04:44:42Z Command-line arg: datadir="/data/bitcoin"
2022-07-21T04:44:42Z Command-line arg: dnsseed="0"
2022-07-21T04:44:42Z Using at most 125 automatic connections (1048576 file descriptors available)
2022-07-21T04:44:42Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-07-21T04:44:42Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-07-21T04:44:42Z Script verification uses 1 additional threads
2022-07-21T04:44:42Z scheduler thread start
2022-07-21T04:44:42Z WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
2022-07-21T04:44:42Z HTTP: creating work queue of depth 16
2022-07-21T04:44:42Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-07-21T04:44:42Z HTTP: starting 4 worker threads
2022-07-21T04:44:42Z Using wallet directory /data/bitcoin/testnet3/wallets
2022-07-21T04:44:42Z init message: Verifying wallet(s)…
2022-07-21T04:44:42Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2022-07-21T04:44:42Z Using wallet /data/bitcoin/testnet3/wallets/wallet.dat
2022-07-21T04:44:42Z BerkeleyEnvironment::Open: LogDir=/data/bitcoin/testnet3/wallets/database ErrorFile=/data/bitcoin/testnet3/wallets/db.log
2022-07-21T04:44:42Z init message: Loading banlist…
2022-07-21T04:44:42Z SetNetworkActive: true
2022-07-21T04:44:42Z Using /16 prefix for IP bucketing
2022-07-21T04:44:42Z Cache configuration:
2022-07-21T04:44:42Z * Using 2.0 MiB for block index database
2022-07-21T04:44:42Z * Using 8.0 MiB for chain state database
2022-07-21T04:44:42Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-07-21T04:44:42Z init message: Loading block index…
2022-07-21T04:44:42Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-07-21T04:44:42Z Opening LevelDB in /data/bitcoin/testnet3/blocks/index
2022-07-21T04:44:42Z Opened LevelDB successfully
2022-07-21T04:44:42Z Using obfuscation key for /data/bitcoin/testnet3/blocks/index: 0000000000000000
2022-07-21T04:44:42Z LoadBlockIndexDB: last block file = 0
2022-07-21T04:44:42Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=1, size=293, heights=0...0, time=2011-02-02...2011-02-02)
2022-07-21T04:44:42Z Checking all blk files are present...
2022-07-21T04:44:42Z Opening LevelDB in /data/bitcoin/testnet3/chainstate
2022-07-21T04:44:42Z Opened LevelDB successfully
2022-07-21T04:44:42Z Using obfuscation key for /data/bitcoin/testnet3/chainstate: fdea64d67eefe6df
2022-07-21T04:44:42Z Loaded best chain: hashBestChain=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 height=0 date=2011-02-02T23:16:42Z progress=0.000000
2022-07-21T04:44:42Z init message: Verifying blocks…
2022-07-21T04:44:42Z  block index              14ms
2022-07-21T04:44:42Z init message: Loading wallet…
2022-07-21T04:44:42Z BerkeleyEnvironment::Open: LogDir=/data/bitcoin/testnet3/wallets/database ErrorFile=/data/bitcoin/testnet3/wallets/db.log
2022-07-21T04:44:42Z [default wallet] Wallet File Version = 139900
2022-07-21T04:44:42Z [default wallet] Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total. Unknown wallet records: 0
2022-07-21T04:44:42Z [default wallet] Wallet completed loading in              49ms
2022-07-21T04:44:42Z [default wallet] setKeyPool.size() = 2000
2022-07-21T04:44:42Z [default wallet] mapWallet.size() = 0
2022-07-21T04:44:42Z [default wallet] m_address_book.size() = 0
2022-07-21T04:44:42Z block tree size = 1
2022-07-21T04:44:42Z nBestHeight = 0
2022-07-21T04:44:42Z loadblk thread start
2022-07-21T04:44:42Z Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
2022-07-21T04:44:42Z loadblk thread exit
2022-07-21T04:44:42Z torcontrol thread start
2022-07-21T04:44:42Z Bound to 127.0.0.1:18334
2022-07-21T04:44:42Z Bound to [::]:18001
2022-07-21T04:44:42Z Bound to 0.0.0.0:18001
2022-07-21T04:44:42Z init message: Loading P2P addresses…
2022-07-21T04:44:42Z Loaded 12 addresses from peers.dat  1ms
2022-07-21T04:44:42Z Loaded 0 addresses from "anchors.dat"
2022-07-21T04:44:42Z 0 block-relay-only anchors will be tried for connections.
2022-07-21T04:44:42Z init message: Starting network threads…
2022-07-21T04:44:42Z DNS seeding disabled
2022-07-21T04:44:42Z net thread start
2022-07-21T04:44:42Z init message: Done loading
2022-07-21T04:44:42Z msghand thread start
2022-07-21T04:44:42Z opencon thread start
2022-07-21T04:44:42Z addcon thread start

Start node2

bitcoind -conf=/data/bitcoin/bitcoin.conf -datadir=/data/bitcoin -dnsseed=0

In advance, I have used bfgminer to mine 7 blocks on noede2.

bitcoin.conf of node2

testnet=1
[test]
rpcuser=test2
rpcpassword=test2
rpcbind=0.0.0.0
rpcport=18333
rpcallowip=127.0.0.1
rpcallowip=172.17.0.1/16
server=1
port=18002

what the node2 output:

2022-07-21T04:49:59Z Bitcoin Core version v22.0.0 (release build)
2022-07-21T04:49:59Z Assuming ancestors of block 0000000000004ae2f3896ca8ecd41c460a35bf6184e145d91558cece1c688a76 have valid signatures.
2022-07-21T04:49:59Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000005180c3bd8290da33a1a
2022-07-21T04:49:59Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2022-07-21T04:49:59Z Using RdSeed as additional entropy source
2022-07-21T04:49:59Z Using RdRand as an additional entropy source
2022-07-21T04:49:59Z Default data directory /root/.bitcoin
2022-07-21T04:49:59Z Using data directory /data/bitcoin/testnet3
2022-07-21T04:49:59Z Config file: /data/bitcoin/bitcoin.conf
2022-07-21T04:49:59Z Config file arg: testnet="1"
2022-07-21T04:49:59Z Config file arg: [test] port="18002"
2022-07-21T04:49:59Z Config file arg: [test] rpcallowip="127.0.0.1"
2022-07-21T04:49:59Z Config file arg: [test] rpcallowip="172.17.0.1/16"
2022-07-21T04:49:59Z Config file arg: [test] rpcbind=****
2022-07-21T04:49:59Z Config file arg: [test] rpcpassword=****
2022-07-21T04:49:59Z Config file arg: [test] rpcport="18333"
2022-07-21T04:49:59Z Config file arg: [test] rpcuser=****
2022-07-21T04:49:59Z Config file arg: [test] server="1"
2022-07-21T04:49:59Z Command-line arg: conf="/data/bitcoin/bitcoin.conf"
2022-07-21T04:49:59Z Command-line arg: datadir="/data/bitcoin"
2022-07-21T04:49:59Z Command-line arg: dnsseed="0"
2022-07-21T04:49:59Z Using at most 125 automatic connections (1048576 file descriptors available)
2022-07-21T04:49:59Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-07-21T04:49:59Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-07-21T04:49:59Z Script verification uses 1 additional threads
2022-07-21T04:49:59Z scheduler thread start
2022-07-21T04:49:59Z WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
2022-07-21T04:49:59Z HTTP: creating work queue of depth 16
2022-07-21T04:49:59Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-07-21T04:49:59Z HTTP: starting 4 worker threads
2022-07-21T04:49:59Z Using wallet directory /data/bitcoin/testnet3/wallets
2022-07-21T04:49:59Z init message: Verifying wallet(s)…
2022-07-21T04:49:59Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2022-07-21T04:49:59Z Using wallet /data/bitcoin/testnet3/wallets/wallet.dat
2022-07-21T04:49:59Z BerkeleyEnvironment::Open: LogDir=/data/bitcoin/testnet3/wallets/database ErrorFile=/data/bitcoin/testnet3/wallets/db.log
2022-07-21T04:49:59Z init message: Loading banlist…
2022-07-21T04:49:59Z SetNetworkActive: true
2022-07-21T04:49:59Z Using /16 prefix for IP bucketing
2022-07-21T04:49:59Z Cache configuration:
2022-07-21T04:49:59Z * Using 2.0 MiB for block index database
2022-07-21T04:49:59Z * Using 8.0 MiB for chain state database
2022-07-21T04:49:59Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-07-21T04:49:59Z init message: Loading block index…
2022-07-21T04:49:59Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2022-07-21T04:49:59Z Opening LevelDB in /data/bitcoin/testnet3/blocks/index
2022-07-21T04:49:59Z Opened LevelDB successfully
2022-07-21T04:49:59Z Using obfuscation key for /data/bitcoin/testnet3/blocks/index: 0000000000000000
2022-07-21T04:49:59Z LoadBlockIndexDB: last block file = 0
2022-07-21T04:49:59Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=8, size=1777, heights=0...7, time=2011-02-02...2022-07-21)
2022-07-21T04:49:59Z Checking all blk files are present...
2022-07-21T04:49:59Z Opening LevelDB in /data/bitcoin/testnet3/chainstate
2022-07-21T04:49:59Z Opened LevelDB successfully
2022-07-21T04:49:59Z Using obfuscation key for /data/bitcoin/testnet3/chainstate: f9352280fbf83854
2022-07-21T04:49:59Z Loaded best chain: hashBestChain=00000000bb370a28309cde9675cdd4ffdabef2b68b535b7a5f12d51657f670f6 height=7 date=2022-07-21T04:06:27Z progress=0.000000
2022-07-21T04:49:59Z init message: Verifying blocks…
2022-07-21T04:49:59Z Verifying last 6 blocks at level 3
2022-07-21T04:49:59Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2022-07-21T04:49:59Z No coin database inconsistencies in last 6 blocks (6 transactions)
2022-07-21T04:49:59Z  block index              12ms
2022-07-21T04:49:59Z init message: Loading wallet…
2022-07-21T04:49:59Z BerkeleyEnvironment::Open: LogDir=/data/bitcoin/testnet3/wallets/database ErrorFile=/data/bitcoin/testnet3/wallets/db.log
2022-07-21T04:49:59Z [default wallet] Wallet File Version = 139900
2022-07-21T04:49:59Z [default wallet] Keys: 2002 plaintext, 0 encrypted, 2002 w/ metadata, 2002 total. Unknown wallet records: 0
2022-07-21T04:49:59Z [default wallet] Wallet completed loading in              49ms
2022-07-21T04:49:59Z [default wallet] setKeyPool.size() = 2000
2022-07-21T04:49:59Z [default wallet] mapWallet.size() = 7
2022-07-21T04:49:59Z [default wallet] m_address_book.size() = 1
2022-07-21T04:49:59Z block tree size = 8
2022-07-21T04:49:59Z nBestHeight = 7
2022-07-21T04:49:59Z loadblk thread start
2022-07-21T04:49:59Z Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
2022-07-21T04:49:59Z loadblk thread exit
2022-07-21T04:49:59Z torcontrol thread start
2022-07-21T04:49:59Z Bound to 127.0.0.1:18334
2022-07-21T04:49:59Z Bound to [::]:18002
2022-07-21T04:49:59Z Bound to 0.0.0.0:18002
2022-07-21T04:49:59Z init message: Loading P2P addresses…
2022-07-21T04:49:59Z Loaded 11 addresses from peers.dat  1ms
2022-07-21T04:49:59Z Loaded 0 addresses from "anchors.dat"
2022-07-21T04:49:59Z 0 block-relay-only anchors will be tried for connections.
2022-07-21T04:49:59Z init message: Starting network threads…
2022-07-21T04:49:59Z net thread start
2022-07-21T04:49:59Z DNS seeding disabled
2022-07-21T04:49:59Z init message: Done loading
2022-07-21T04:49:59Z msghand thread start
2022-07-21T04:49:59Z opencon thread start
2022-07-21T04:49:59Z addcon thread start

Then, I use the below command to connect node1 and node2

bitcoin-cli -conf=/data/bitcoin/bitcoin.conf addnode "172.17.0.3:18002" onetry

The output is just one line in node1 and nothing else, no outputs on node2:

2022-07-21T04:50:38Z New outbound peer connected: version: 70016, blocks=7, peer=0 (manual)

And then, I use wireshark to capture the Packet between these two nodes. And I found that there weren't any "headers" message to response the "get headers" message. I put the screenshot below, if it is unclear just tell me to modify it.

enter image description here

What confuses me is that the Node1 didn't sync the 7 blocks and header etc. from Node2 and I don't know why.

Use getpeerinfo on node1, and I got this:

[
  {
    "id": 0,
    "addr": "172.17.0.3:18002",
    "addrbind": "172.17.0.2:44972",
    "network": "not_publicly_routable",
    "services": "0000000000000409",
    "servicesnames": [
      "NETWORK",
      "WITNESS",
      "NETWORK_LIMITED"
    ],
    "relaytxes": true,
    "lastsend": 1658380493,
    "lastrecv": 1658380493,
    "last_transaction": 0,
    "last_block": 0,
    "bytessent": 1077,
    "bytesrecv": 1352,
    "conntime": 1658379413,
    "timeoffset": 0,
    "pingtime": 0.00043,
    "minping": 0.000167,
    "version": 70016,
    "subver": "/Satoshi:22.0.0/",
    "inbound": false,
    "bip152_hb_to": false,
    "bip152_hb_from": false,
    "startingheight": 7,
    "synced_headers": -1,
    "synced_blocks": -1,
    "inflight": [
    ],
    "addr_processed": 2,
    "addr_rate_limited": 0,
    "permissions": [
    ],
    "minfeefilter": 0.09170997,
    "bytessent_per_msg": {
      "feefilter": 32,
      "getaddr": 24,
      "getheaders": 93,
      "ping": 320,
      "pong": 320,
      "sendaddrv2": 24,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126,
      "wtxidrelay": 24
    },
    "bytesrecv_per_msg": {
      "addrv2": 107,
      "feefilter": 32,
      "getheaders": 285,
      "ping": 320,
      "pong": 320,
      "sendaddrv2": 24,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126,
      "wtxidrelay": 24
    },
    "connection_type": "manual"
  }
]

Use getpeerinfo on node2, and I got this:

[
  {
    "id": 1,
    "addr": "172.17.0.2:44972",
    "addrbind": "172.17.0.3:18002",
    "network": "not_publicly_routable",
    "services": "0000000000000409",
    "servicesnames": [
      "NETWORK",
      "WITNESS",
      "NETWORK_LIMITED"
    ],
    "relaytxes": true,
    "lastsend": 1658380493,
    "lastrecv": 1658380493,
    "last_transaction": 0,
    "last_block": 0,
    "bytessent": 1352,
    "bytesrecv": 1077,
    "conntime": 1658379413,
    "timeoffset": 0,
    "pingtime": 0.000598,
    "minping": 0.000176,
    "version": 70016,
    "subver": "/Satoshi:22.0.0/",
    "inbound": true,
    "bip152_hb_to": false,
    "bip152_hb_from": false,
    "startingheight": 0,
    "synced_headers": -1,
    "synced_blocks": -1,
    "inflight": [
    ],
    "addr_processed": 0,
    "addr_rate_limited": 0,
    "permissions": [
    ],
    "minfeefilter": 0.09170997,
    "bytessent_per_msg": {
      "addrv2": 107,
      "feefilter": 32,
      "getheaders": 285,
      "ping": 320,
      "pong": 320,
      "sendaddrv2": 24,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126,
      "wtxidrelay": 24
    },
    "bytesrecv_per_msg": {
      "feefilter": 32,
      "getaddr": 24,
      "getheaders": 93,
      "ping": 320,
      "pong": 320,
      "sendaddrv2": 24,
      "sendcmpct": 66,
      "sendheaders": 24,
      "verack": 24,
      "version": 126,
      "wtxidrelay": 24
    },
    "connection_type": "inbound"
  }
]

Above is all the description of my problem.

English is not my first language. So if there is anything unclear above , please comment below and I will response as soon as I can.

Any advice would be much helpful for me. Thanks in advance.

0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.