§ 12 · Networking
Peers and seeds
How a brand-new node finds its first friends
On this page 5 sections
A node on its own is useless: it can’t hear about new blocks or share its own. It needs peersPeer: Another node that yours is directly connected to. Blocks and transactions spread from peer to peer., other nodes it keeps a connection open with. But a brand-new node, just installed, doesn’t know the address of a single one.
The fix is the same as Bitcoin’s. A few well-known names, the DNS seedsDNS seed: A name server that gives a brand-new node the addresses of active nodes, so it can find its first peers. Pearl mainnet has 3., answer with a list of working nodes. After the first connections, the node learns more addresses from its peers and never needs the seeds again.
Try it
The live state of the network those peers keep in sync: tip height, difficulty and pace.
Which DNS seeds does Pearl use?
Three, built into pearld for mainnet:
- DNS seed
- reef
- reef.seeder.pearlnetwork.net
- DNS seed
- tide
- tide.seeder.pearlnetwork.net
- DNS seed
- stream
- stream.seeder.pearlnetwork.net
A node looks these names up like any website. Instead of one server’s address, the answer is a handful of IP addresses of Pearl nodes. The node then connects to some of them on port 44108.
Testnet and testnet2 have their own seeds, under seeder.testnet.pearlnetwork.net and seeder.testnet2.pearlnetwork.net.
Which nodes does a seed list?
Pearl’s seeder is a plugin for CoreDNS, a common DNS server, and it’s in Pearl’s repository. It crawls the network in the background and only lists a node that passes every check below. The rules are fixed in code, not configurable:
-
It completes a handshake
The seeder connects and swaps version messages, as a real peer would.
-
It speaks a recent enough protocol
At least the minimum protocol version, 2.
-
It's a full node
It advertises the full-node service bits.
-
It's on the current chain
It reports a height at or above the latest checkpoint, which, in the README’s words, “weeds out nodes stranded on a pre-fork chain”.
-
It listens on the default port
44108 on mainnet.
Each crawl re-checks the nodes it serves, asks live peers for more addresses with getaddr, and checks those too. A served node that fails two crawls in a row stops being listed and enters a three-hour cooldown.
A DNS answer holds a random sample of up to 25 addresses, and resolvers may cache it for 3,600 seconds, an hour.
What happens after the seeds?
Address gossip, inherited from Bitcoin via btcd:
- A node asks its peers for addresses with
getaddr. - Peers answer with
addrmessages, oraddrv2(BIP-155) once both sides have saidsendaddrv2;addrv2can carry newer address types. - The node keeps everything in an address book on disk and picks future peers from it.
So the seeds matter once, at first start. A node that has run for a while can rejoin the network from its address book alone.
What does a node say about itself?
When two nodes connect, after encrypting the connection, each sends a version messageVersion handshake: The first two messages two nodes swap after connecting: each sends a version message (protocol version, services, user agent) and answers the other’s with verack.. Three fields matter here:
| Field | Size | Description |
|---|---|---|
| Protocol version | 4 | 2. pearld refuses peers below 2. Pearl numbers its protocol from scratch; Bitcoin's is in the 70,000s. |
| Services | 8 | 0xc4d by default: full blocks, bloom filters, witnesses, compact filters, recent blocks, encrypted transport. See nodes. |
| User agent | varies | /pearlwire:0.5.0/pearld:1.5.2/: the wire library's version, then the node's. Informational only. |
The user agentUser agent: A short label a node sends to its peers naming its software, like /pearlwire:0.5.0/pearld:1.5.2/ for pearld 1.5.2. It is informational only. is the same one Pearl’s public Blockbook reports for its own backend node, so you can see which software the explorer runs. The protocol versionProtocol version: A number that says which message formats a node speaks. Pearl's is 2, and nodes refuse peers below 2. and servicesService flags: Bits a node sets in its version message to say what it offers, such as full blocks, compact block filters or encrypted transport. are what a peer actually relies on.
Make a guess
You run pearld behind a firewall and only open port 44107. Will DNS seeds ever list your node?
Think of your answer first, then check it.
Answer No.
44107 is pearld’s local RPC port. Peers connect on 44108, and the seeder only lists nodes that accept connections on that default P2P port. Your node can still make outgoing connections and stay in sync; it just won’t be handed out to newcomers.
Code: seeds and handshake values
The seeds, from params.go (node/chaincfg/params.go:344-349 at v1.5.2, on GitHub). The false means the seeder
doesn’t support filtering by service bits in the DNS name:
DefaultPort: "44108",
DNSSeeds: []DNSSeed{
{"reef.seeder.pearlnetwork.net", false},
{"tide.seeder.pearlnetwork.net", false},
{"stream.seeder.pearlnetwork.net", false},
}, The protocol version is set in protocol.go (node/wire/protocol.go:12-16 at v1.5.2, on GitHub) and the minimum in
peer.go (node/peer/peer.go:34-44 at v1.5.2, on GitHub), whose comment explains why they move separately: raising both
together “would disconnect not-yet-upgraded peers that still share our chain”.