1

I run node 1 using this command:

bitcoind -port=2222 -datadir=/home/prayank/node1 -conf=/home/prayank/node1/bitcoin.conf -regtest=1 -rpcport=18666 -rpcuser=rpcuser -rpcpassword=rpcpass -bind=127.0.0.1

and node 2 with:

bitcoind -port=3333 -datadir=/home/prayank/node2 -conf=/home/prayank/node2/bitcoin.conf -regtest=1 -rpcport=18777 -rpcuser=rpcuser -rpcpassword=rpcpass -connect=127.0.0.1:2222
  1. Why is 18445 port used to bind when 2222 was mentioned in -bind while running bitcoind (node 1)?
2022-01-21T14:31:51Z Bound to 127.0.0.1:2222
2022-01-21T14:31:51Z Bound to 127.0.0.1:18445
  1. Manual outbound connection was successful however I want to do this automatically. How can I run a node 3 which discovers one of these nodes and creates an outbound connection automatically (node 2)?
2022-01-21T14:34:06Z New outbound peer connected: version: 70016, blocks=110, peer=0 (manual)

1 Answer 1

2

Why is 18445 port used to bind when 2222 was mentioned in -bind while running bitcoind (node 1)?

When torcontrol is enabled, Bitcoin Core will listen on two separate ports by default: one for incoming connections from the public network, and one for incoming connections from tor. Using two separate ports helps Bitcoin Core distinguish which connections are tor connections and which ones aren't.

You can override the port for incoming Tor connections too: -bind=127.0.0.1:2223=onion would listen on port 2223 for those (and tell tor to forward incoming tor connections there).

How can I run a node 3 which discovers one of these nodes and creates an outbound connection automatically (node 2)?

Automatic connections are only for connecting to publicly reachable nodes. Unless you expose your 127.0.0.1:2222 port somehow to the Internet, the automatic connection mechanism doesn't apply here. Even if it is, that's probably not what you want.

Your Answer

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