The importance of Seed Nodes and how do I connect to them

I thought I might put some info together for those who may be interested in the technology behind discovering other nodes on the network.
As you may know, almost every cryptocurrency today operates on a peer to peer network.
This is the the strength of the network having each node decentralised.
But how does it work exactly?
How does a node (your client wallet) discover any of the other nodes if you have only just downloaded the client fresh and it has never seen those node before?

Well, there are a few methods available.

  1. In the client there are some hard coded DNSSeed nodes
  2. In the client, there are some hard coded nodes
  3. By adding -seednode to your startup
  4. By adding -addnode to your startup
  5. By adding -connect to your startup
  6. Reading from peers.dat
  7. Retrieve a list of hosts via IRC (obsolete)

When you first launch your wallet, it will use one of these above methods to attempt to connect to other nodes on the network. If it is able to make a connection with 1 or more nodes, it will request a list of other clients that may be reachable.

Option 1,
These nodes are written into the source code of the software and are updated periodically to reflect the growth of the network
DNSSeed nodes are usually operated under a system of trust. and relies on those hard coded DNSSeed nodes to always be available.
For users, the cool thing about DNSSeed nodes is that they maintain a dynamic list of available hosts along with their reliability.
It is constantly checking and discovering nodes on the network and measuring their reliability
When your client first connects to the DNSSeeder, the DNSSeeder will return a list of reliable nodes that your client can connect with.
Once that connection is made and the list returned, the job is done, and your client would not normally connect again.
Your client will store those returned addresses in the peers.dat file and will then use them to connect out onto the network.

Option 2.
These nodes are encoded and written into the source code of the software and are updated periodically to reflect the growth and changing network. These are essentially full nodes, but are encoded into the wallet so that other clients can find nodes to connect to. They are also operated under a system of trust. and relies on those hard coded nodes to always be available. If the nodes become unavailable, they become candidates to be removed from the source code.

Option 3.
This is similar to Option 1. except that you can you use this method to connect to other DNSSeed nodes that are not included in the main wallet.
-seednode= commandline option
seednode= conf file
Your client will connect to these servers to retrieve addresses, and disconnect.

Option 4.
You have probably seen this before, where new crypto coin developers havent established a network other than than the genesis node (first node). As the network has not been established, you are requested to add in nodes for your client to connect to using either
-addnode= from the commandline
addnode= in the conf file
Your client will connect to and attempt to keep the connection open. It will use this connection to request addresses from these nodes.

Option 5.
This method establishes a connection only to the listed nodes
-connect= from the commandline
connect= in the conf file

Option 6.
Peers.dat is not directly editable, and is used by your client once it has established a connection to the network. Periodically the client will save a list of addresses to the file. If you have valid addresses in the peers.dat file, your client will read this file and use these to connect to the network

Option 7.
This is now an obsolete method, but is worth mentioning.
Clients would look to the IRC server for a list of active nodes.
Interestingly, the Electrum Servers can use this method to announce availability.
[ Work In Progress - Ask any questions and i will update the OP ]

Thank you very much for the write up Gnasher .

This is really interesting stuff and researching that latest newsletter coupled with reading the detailed info you give here has really helped to clarify the purpose of seed nodes for me.

It is interesting to note also that there is no fully trustless way currently being used to carry out the work done by seed nodes to kick start new wallets. That is to say that the source of information about full nodes (and ultimately therefore the source of the blockchain itself) is chosen by a single person or team (seed node hard coded into wallet by dev, for example).

So I guess the game is on to find a decentralised way to point a new wallet to the blockchain.


Excellent write-up. I’ll be linking to this from /r/nyancoins.

Regarding a “fully trustless way” to get seed nodes, I don’t think that would ever be possible. You have to start with trust in something to get some initial place to start looking. I don’t think that’s unreasonable. The alternative would be to randomly scan anywhere and everywhere until a node is found which would be inelegant to say the least and of course there would be no reason to believe that randomly found node is trustworthy.

However, regarding a “decentralised way”, well, that’s already there: one could simply remove the hard-coded nodes and rely entirely upon some decentralised source of information for nodes, then launch with those in addnode. I don’t think that’s better than the “centralised” solution of having some hardcoded nodes and being able to fallback on decentralised searches for nodes if those fail.

In Nyancoins, this is not academic: the original seeds in our client were all dead (we’ve since gotten the hardcoded DNSSeed back online thanks to smart thinking and good work by Nekonaut jwflame), and so our only way to launch the client was by getting a node from the subreddit. That may not sound decentralized, but the revival could have started from anywhere and all they needed to do was post a reliable node and the addnode command.

But it was better once we got the DNSSeed back online. Sure, it’s a central source. But so is our block explorer. So is our forum. The chain itself is decentralized but for convenience we don’t need to work that hard on the peripheral infrastructure nor on routine startup.

Just my 0.02BTC from working on this. As long as you’ve got a few reliable nodes which stick around between releases, the hardcoded seeds and nodes should be fine. Personally, I’m planning on adding back in the IRC method as well for NYAN2.1 or so (2016Q1 hopefully); I think that makes a nice last resort fallback.