Nowadays there are DNS seeds and hardcoded IP addresses, but back in the day when Satoshi released Bitcoin v0.1, how did new nodes connect to the rest of the network? My initial thought was that the first release would have Satoshi's IP address hardcoded, but I couldn't find anything of the sort in the source code.
2 Answers
- The first seed mechanism was IRC-based. There was a hardcoded IRC server and IRC channel (
#bitcoin
on Freenode), and the Bitcoin client would connect to the server, and join the channel with a nickname that encodes the client's IP address. Through that, it would receive "JOIN" messages from other Bitcoin clients joining the channel, which would get inserted into its IP address database. - In version 0.2.12 (June 2010), hardcoded seed IPs were added, as a fallback for when IRC seeding failed.
- In version 0.3.0 (June 2010), the IRC server was changed from Freenode to LFnet.
- In version 0.3.21 (April 2011), the DNS seeding mechanism was introduced (but off by default).
- In version 0.3.22 (June 2011), the IRC seeding mechanism was extended to 100 channels instead of one, due to it growing too big. Every client would randomly join one of the channels.
- In version 0.3.24 (July 2011), DNS seeding was enabled by default.
- In version 0.6.0 (March 2012), the IRC seeding mechanism was turned off by default.
- In version 0.9.0 (March 2014), support for the IRC seeding mechanism was completely removed from the codebase.
Quoting from the wiki:
In addition to learning and sharing its own address, the node learned about other node addresses via an IRC channel. See irc.cpp.
After learning its own address, a node encoded its own address into a string to be used as a nickname. Then, it randomly joined an IRC channel named between #bitcoin00 and #bitcoin99. Then it issued a WHO command. The thread read the lines as they appeared in the channel and decoded the IP addresses of other nodes in the channel. It did this in a loop, forever, until the node was shutdown.
When the client discovered an address from IRC, it set the timestamp on the address to the current time, but it used a "penalty" of 51 minutes, which means it looked like it was actually seen almost an hour earlier.