What is the difference between inbound and outbound connections?

7

2

I have port 8333 open with 8 outbound and 2 inbound connections.

Is my node transmitting and receiving transactions and blocks from both types of connections? Or does the "inbound" flag mean I am just downloading from that peer, and not sending any information back?

If, for the sake of saving RAM, I set maxconnections to 8, will they all be outbound? Even if port 8333 is open? In this configuration, is my node still "helping" the network?

pinhead

Posted 2016-01-11T23:12:32.600

Reputation: 2 356

3

To the best of my understanding: Inbound means the remote peer initiated the connection to you. Outbound means you made the connection to a remote peer. This is just diagnostic info and doesn't affect behavior. Transactions and blocks can flow in both directions with any peer - unless the peer has the relay bit set to off.

Nayuki 2016-01-12T01:08:41.337

@NayukiMinase: Feel free to post that as an answer! :)Murch 2016-01-12T19:12:08.043

I feel that what I wrote doesn't provide objective evidence to support the statements, and I haven't answered all parts of the OP's question...Nayuki 2016-01-13T04:22:57.910

Answers

1

If your node initiated the connection, it's outbound, otherwise it's inbound. Nodes will send and receive data from both types of connections exactly the same way.

maxconnections sets a limit on the total number of connections, so if you set it to eight, your node will probably initiate connections to other eight nodes before any node can initiate a connection to it.

Keep in mind that according to this forum post, each open connection will take only a few kilobytes of RAM, so reducing the number of connections might not save all that much of memory.

EDIT: By running a full node that has no slots for incoming connections, you act as a leecher, and you do more bad than good for the Bitcoin network, as Gavin Andresen said on Reddit. You would help the network if you allowed a few inbound connections. As discussed earlier, that's unlikely to take up any significant amount of RAM.

Wladston Viana Ferreira Filho

Posted 2016-01-11T23:12:32.600

Reputation: 138

Why would you automatically be a leecher just because you don't accept inbound connections? Don't honest full nodes send and receive data regardless of who made the connection (outbound or inbound)?B T 2019-06-03T01:07:43.683

1By running a full node, you still help the network, even if your node has no slot for incoming connections. How? If nothing is using you're node as a trusted source of data, you're just relaying blocks and transactions. More peers, however, means more hops and more validation, which means slower propagation times for both transactions and blocks.morsecoder 2016-01-25T14:59:56.863

@StephenM347 you are correct. I did some extra research and confirmed what you said. Edited the answer, thanks.Wladston Viana Ferreira Filho 2016-01-25T17:42:24.550