How does a Bitcoin node connect to more than 65536 other nodes?


I found on the internet that Bitcoin uses TCP to communicate with other nodes, connecting to them and sending messages. But a computer cannot bind more than 65536 sockets (because of TCP ports), so how can a node connect to more than 65536 nodes?


Posted 2020-12-18T21:13:21.920

Reputation: 3


Does this answer your question? How does one attain 1,000+ connections like

– MCCCS – 2020-12-18T21:35:38.607

Why would you want/need to? – chytrik – 2020-12-18T21:41:06.423

@MCCCS Um, the answers to that question say that a Bitcoin node will not open more than 8 connections. So, as I understand it, for a block to be spread to several nodes, one node passes to another, which passes to another, and so on. Right? And if the answer is yes, wouldn't that be bad and would you need one node to trust the other nodes in the network? – Papaulo – 2020-12-18T22:50:58.420

@chytrik I am trying to learn and understand Bitcoin protocol. – Papaulo – 2020-12-18T22:51:23.547


This does not seem related to Bitcoin, but is a generic question about TCP/IP network stacks. The relevant part on this SE site is simple: Bitcoin nodes only make a few outbound connections (usually in the range 4-10). The generic part is asked and answered here:

– Pieter Wuille – 2020-12-18T22:56:05.063

@PieterWuille But isn't bad that a node needs to trust that other nodes will broadcast its transaction or block? – Papaulo – 2020-12-18T23:08:32.177


That seems like an independent question. In short: for transactions, perhaps, but you can always connect to miners directly, and there isn't much that can be done about it (the network would rapidly run out of sockets if everyone connected to everyone; most nodes can't even be connected to at all). For blocks, nodes have an incentive to relay blocks (to help the network converge to their own view of the chain), and you will detect when you're partitioned off. Related reading:

– Pieter Wuille – 2020-12-18T23:57:27.250

No answers