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?
Asked
Active
Viewed 113 times
0
-
1Does this answer your question? How does one attain 1,000+ connections like blockchain.info? – MCCCS Dec 18 '20 at 21:35
-
Why would you want/need to? – chytrik Dec 18 '20 at 21:41
-
@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 Dec 18 '20 at 22:50
-
@chytrik I am trying to learn and understand Bitcoin protocol. – Papaulo Dec 18 '20 at 22:51
-
1This 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: https://serverfault.com/questions/160996/more-than-65536-tcp-connections-on-linux – Pieter Wuille Dec 18 '20 at 22:56
-
@PieterWuille But isn't bad that a node needs to trust that other nodes will broadcast its transaction or block? – Papaulo Dec 18 '20 at 23:08
-
1That 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: https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-heilman.pdf – Pieter Wuille Dec 18 '20 at 23:57