Protocol Labs Research
2022-09-28 / Conference paper
Decentralized hole punching
DINPS 2022 / 2022.07.10 / Bologna, Italy
Marten Seemann , Max Inden, Dimitris Vyzovitis


We present a decentralized hole punching mechanism built into the peer-to-peer networking library libp2p. Hole punching is crucial for peer-to-peer networks, enabling each participant to directly communicate to any other participant, despite being separated by firewalls and NATs. The decentralized libp2p hole punching protocol leverages protocols similar to STUN (RFC 8489), TURN (RFC 8566) and ICE (RFC 8445), without the need for any centralized infrastructure. Specifically, it doesn’t require any previous knowledge about network participants other than at least one (any arbitrary) node to bootstrap peer discovery. The key insight is that the protocols used for hole punching, namely address discovery and relaying protocols, can be built such that their resource requirements are negligible. This makes it feasible for any participant in the network to run these, thereby enabling the coordination of hole punch attempts, assuming that at least a small fraction of nodes is not located behind a firewall or a NAT.