bitcoin.conf: connect= vs. addnode=

In the context of the bitcoin.conf file, the connect= option and the addnode= option serve different purposes regarding peer connections.

connect=

Purpose

The connect= option specifies one or more specific nodes that your Bitcoin node will only connect to.

Behavior

When you use connect=, your node will exclusively establish connections with the specified IP addresses and will not connect to any other nodes on the network. This can be useful for:

Limitation: It will not learn about or connect to other nodes that the specified node is connected to.

addnode=

Purpose

The addnode= option adds a node to a list of nodes that your Bitcoin node will attempt to connect to, in addition to its normal discovery process.

Behavior

Benefit: This option is helpful for situations like being behind a firewall where your node might have difficulty finding other peers on its own.

In Simpler Terms

connect= is like telling your node: "Only connect to these specific people."

addnode= is like telling your node: "Connect to these people, and ask them who else they know so you can connect to them too."

Example Use Case

If you are running multiple nodes on a local network and want them to prioritize connecting to each other for efficiency and lower bandwidth usage, you could use connect= to point each node towards the others.

If you are behind a restrictive firewall and need help finding other nodes, you could use addnode= to connect to a well-connected node that can introduce your node to others in the network.