I am writing a simple program that connects to nodes in order to index them, kind of like blockchain.info nodes works. Doing this in GLang using the btcd/wire library to create the messages, the message sequence is as follows:

Version ->
<- Version
<- Version Acknowledge
<- Ping
Pong ->
GetAddr ->
<- Addr

However upon reading the list of addresses returned they all are either empty or contain a single address that corresponds to that nodes address (I.E. it returns its own address).

From reading the wiki I know nodes only return addresses of connected nodes that have a timestap less than 3 hours ago, and that there are certain dns nodes and seed nodes. Are there any nodes that will always return connected peers regardless of their age? Or any way to bootstrap the process? How does a normal full node connect to more than a handful of nodes when these may never return anything (if they have been alive for more than 3 hours, then they will only return something on new connections)?


What worked for me was sending a ping message. Also, the addr message didn't come directly. I had to keep listening on the same port for at least a second.

You can use the dns seeds as a starting point, however a large portion of nodes might still only give you their own address. If anyone knows why I'm curious to hear, but I think every client just has its own way of dealing with these messages.

Version ->
<- Version, Verack
Verack ->
Ping ->
GetAddr ->
<- Pong, Ping, ManyMoreThings
<- Addr

Your Answer

