It is said that the nodes communicate over tcp but how is that acheived across networks over different Nats
1 Answer
different networks
Ordinary plain IP routing.
different Nats
The Bitcoin network protocol uses standard TCP sockets with a typical destination TCP-port number of 8333.
The use of Network Address Translation (NAT) by many last-hop routers makes it harder to connect to Bitcoin nodes that use IPV4 private addresses behind a router. In theory the use of IPV6 addresses should make this issue go away.
I believe the NAT traversal for Bitcoin IPV4 TCP connections probably uses whatever features are provided by the underlying network libraries and/or are configured in the OS by the end-user.
So far as I know, there isn't a Bitcoin-specific solution for this. There are a lot of general solutions that may be appropriate to use.
See
- What is the NAT traversal technique used by bitcoin - which has answers mentioning specific support for UPNP if configured.
- Can exist bitcoin network with all nodes behind NAT?
- How does bitcoin core establish a peer to peer network
- Running a Bitcoin node (behind Firewall / NAT or anything else? disallowing inbound connections)
-
Yes, there is nothing special about Bitcoin in this regard compared to e.g. a Minecraft server. It's just plain old TCP/IP. NAT traversal is another matter; if a node behind a NAT wants to be accessible on the public internet, the NAT needs to be configured to forward traffic sent to a particular port on the public address to the node. Dec 20, 2022 at 21:38