In the age of hyperscale cloud computing and RESTful APIs, it is easy to forget that the internet was originally conceived as a mesh of peers. While most users interact with centralized servers, a parallel universe of decentralized networks still thrives—Bitcoin, Ethereum (pre-merge), BitTorrent, and Tor. At the heart of these networks’ ability to bootstrap connectivity lies a humble, often-overlooked file: nodes.dat .
The classic solution is a hardcoded list of seed nodes (e.g., seed.bitcoin.sipa.be ). However, these seeds can be compromised, go offline, or be censored. Enter nodes.dat : a local cache of previously successful peer connections. nodes dat
from bitcoin.core import * with open('peers.dat', 'rb') as f: magic = f.read(4) count = deser_compact_size(f)[0] for _ in range(count): addr = deser_uint64(f) # time services = deser_uint64(f) ip = socket.inet_ntop(socket.AF_INET6, f.read(16)) port = deser_uint16(f) print(f"ip:port - services") The nodes.dat file is a masterpiece of minimalist engineering. It solves a distributed systems paradox— How do you find the network without already being on it? —using a few hundred kilobytes of binary data. While modern clients have evolved to peers.dat and more sophisticated address managers, the legacy of nodes.dat persists in every Bitcoin fork and every DHT node. In the age of hyperscale cloud computing and
To the uninitiated, nodes.dat looks like a simple binary blob. To a network engineer or a cryptocurrency analyst, it is a —the difference between a node finding the network in milliseconds versus hours. This article dissects the nodes.dat file from its binary structure to its strategic importance in censorship resistance. 1. What is nodes.dat ? The Bootstrapping Problem Decentralized networks have no central server to ask, “Where is everyone?” When you start a fresh P2P client (e.g., Bitcoin Core for the first time), it knows nothing—no IP addresses, no ports, no peers. This is the bootstrapping problem . The classic solution is a hardcoded list of seed nodes (e
For the end user, it’s just a file. For the network, it’s a collective memory. And for the adversary, it’s a map of the resistance. Further reading: Bitcoin Developer Reference – Address Relay | Eclipse Attacks on Bitcoin’s Peer-to-Peer Network (USENIX Security 2015)
nodes.dat is a serialized file, typically stored in the data directory of a P2P application (e.g., ~/.bitcoin/ or %APPDATA%\Bitcoin\ ), containing a list of network addresses (IP:Port), timestamps of last successful connections, and network flags (e.g., whether the peer supports Bloom filters or SegWit). 2. Binary Anatomy: How nodes.dat is Built While implementations vary by client, Satoshi Nakamoto’s original Bitcoin design set a de facto standard. Let's dissect the Bitcoin Core approach (versions 0.8 to 24+). The Serialization Format nodes.dat is not a simple CSV or JSON. It is a binary stream using Bitcoin’s custom CPeerAddr serialization. The structure is: