Beginning Blockchain by Bikramaditya Singhal Gautam Dhameja & Priyansu Sekhar Panda

Beginning Blockchain by Bikramaditya Singhal Gautam Dhameja & Priyansu Sekhar Panda

Author:Bikramaditya Singhal, Gautam Dhameja & Priyansu Sekhar Panda
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Step-2:

There is a new node, say, a seventh node that just showed up and is trying to join the existing Bitcoin network, but does not have any connection yet. Refer to Figure 3-11.

Figure 3-11A new node trying to join the network

Step-3:

The seventh node will try to reach out to as many nodes as it can either using DNS seeds or using the list of stable Bitcoin nodes in the list that it has—as shown in Figure 3-12.

Figure 3-12New Bitcoin node contacts some peers

In the diagram, we have skipped the DNS resolution part. It is the same as when you browse any website with its name and post DNS resolution the IP address is retrieved, which is then used as the destination webserver’s address to send TCP packets to. To connect to a new peer, the node establishes a TCP connection on port 8333 (port 8333 is well known for Bitcoins but could be different). Then the two nodes handshake with information such as version number, time, IP addresses, height of blockchain, etc. The actual Bitcoin code for “Version” message defined in net.cpp is as shown in the following:

PushMessage( "version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,

nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION,

std::vector<string>()), nBestHeight, true );



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.