I've tried to look for an answer to this online and haven't found any. My question is: how does bitcoin establish a peer to peer network. Establishing a centralized network with a server in the middle between all clients is trivial. However, establishing a fully peer to peer network isn't that easy. This is mostly due to NATs and Firewalls. How does bitcoin core get around NATs and Firewalls. Does it use holepunching, and, if so, is there a central server that dynamically updates public and private Ip/ports? I guess I would just like to know how the peer to peer network is established.


1 Answer 1


The Bitcoin P2P protocol is an application-specific layer over TCP/IP.

If a node does not have an open port by themselves, they can only make outgoing connections. Node software uses things like UPnP to request NATs to open ports, but if that fails, a node's connections will be unidirectional.

  • If a node's connection becomes unidirectional, then it can only make requests to other nodes with public IPs and Ports. Is that how unidirectionally connected nodes update their blockchain? Jul 11, 2020 at 19:32
  • Could you briefly elaborate on what UPnP is please. Jul 11, 2020 at 19:33
  • Yes, but the protocol is symmetric. So if a node can only make outbound connections, that is still a fully-featured connection between two nodes - it doesn't matter who established the connection. There isn't a "server" and "client" side to the connection. Jul 11, 2020 at 20:23
  • 1
    Yes, in terms of connectivity you are right, but not in terms of functionality. If A connects B, then it will be both the case that A requests things from B, and B requests things from A. Jul 11, 2020 at 21:41
  • 1
    let me go a bit OT @PieterWuille to show gratitude for the effort you put in cryptospace and your attitude you keep showing to help people since long time Jul 12, 2020 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.