HOW-TO Connect 2 bitcoin nodes (in a simple and practical way)

The following guide is based on the idea of ​​connecting 2 bitcoin nodes, with the intention that one of them syncs directly with the other. In my particular case, it was to connect my 2 bitcoin nodes within my LAN.

To do this, there are 2 ways to do it using one of the following commands, depending on our needs and what we want.

The commands are the following.

"addnode=ip-of-the-node-to-add:8333"

"connect=ip-of-the-node-to-add:8333"

There is an important difference that we must take into account.

addnodewill add the node permanently but it will continue receiving connections from other nodes outside. That is, it will be one more of the connected nodes and, when receiving connections from other nodes outside, it will continue consuming your bandwidth. Something quite noticeable when you have to download the entire blockchain, for example.

connectwill add the node permanently but it will not receive connections from other nodes outside. That is, it will be the only node connected. Therefore, by not receiving connections from other nodes outside, it will not continue consuming your internet bandwidth, but all communication will be within your own internal network. Remember that, in my particular case, it was connecting my 2 bitcoin nodes within my LAN. Obviously, if you use this mode to connect to a node that is not on your LAN, it will continue consuming your internet bandwidth.

The procedure is as follows.

We identify our nodes. For example, “node1” being the node we want to connect to and “node2” being the node we want to connect to “node1”.

For this, you should have already assigned a fixed IP to each node. If you don’t know how to do it, here is a guide.

HOW-TO Static IP on UmbrelOS (in a simple and practical way)

We connect via SHH to node2 to tell it to connect directly to node1. To do this, we enter the path of the file to be configured and press “Enter”

sudo nano /home/umbrel/umbrel/app-data/bitcoin/data/bitcoin/bitcoin.conf

It will show us the content of the file to edit which should show the following.

# Load additional configuration file, relative to the data directory.
includeconf=umbrel-bitcoin.conf

Here we will proceed to add the command according to what we need. As an example, my case. I want to connect node2 to node1 permanently and make it the only node connected without receiving connections from other nodes outside. To do this, I will use the “connect” command and it should be like this.

connect=192.168.10:8333

Where the IP 192.168.10 is the IP of node1 to which I want to connect and :8333 the indicated and default listening port.

Then, under the content of the existing file, we will add the following.

# [network]
# Connect only to the specified node(s); can be set multiple times. Set to 0 to disable automatic connections.
connect=192.168.10:8333

The total content of the file to be edited should be like this.

# Load additional configuration file, relative to the data directory.
includeconf=umbrel-bitcoin.conf
# [network]
# Connect only to the specified node(s); can be set multiple times. Set to 0 to disable automatic connections.
connect=192.168.10:8333

Once you’ve done the above, save and close (CTRL+X). You’re back to the main SHH connection window.

Restart your server.

When you restart, your node2 will automatically connect to your node1.