0

I am studying blockchain, cpp and crypto so I cloned bitcoin and created a new altcoin.

everything it is working fine as I expected, but i have some questions which i could not find a answer.

the question it is about nodes,let me explain my case.

I have now 3 VM's running the bitcoin clone wallets which it is a new coin now.

vm 1 = it is connected to the node 100.00.00.0

coinname.conf

addnode=100.00.00.0

vm 2 = it is the server which provide the ip: 100.00.00.0 for the vm 1

vm 3 = random wallet as well connected to the ip 100.00.00.0 for the vm2.

coinname.conf

addnode=100.00.00.0

I removed the nodes and dns from net.cpp for do this experiment ok?

strMainNetDNSSeed[][2]

pnSeed[]

so I started do experiment, turning of the VM 2 which provides the ip for the wallets connect.

after this the VM1 and VM3 lost the connection, fine I expected that.

so my question is, how the wallet VM 1 and VM 3 will connect by themselves and keep the networking running if the VM 2 if the server it is offline? and as well if the 2 users don't know the ip it is sharing the nodes?

I searched this topics bellow but i could not find what I am looking for.

How does bitcoin find peers?

How do bitcoin nodes initially find peers?

https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery

EDIT: the user bellow was right, after while the other wallets get the peers and nodes , so does not matter anymore if the VM2 it is offline, the network keeps on, amazing thing about bitcoin. :)

1

The client has to download a list of peers when it connects for the first time to the network. Known peers are broadcasted by nodes who previously knew other nodes. All this chain starts however from at least two IPs which are known to both of nodes.

Your clients will check for known peers, after they downloaded a list of known peers from the VM2 (based on your examples) to establish a connection in the event of hardcoded or conf nodes fails.

To be more precise:

The Bitcoin client has a number of sources that it uses to locate the network on initial startup. In order of importance:

1) The primary mechanism, if the client has ever run on this machine before and its database is intact, is to look at its database. It tracks every node it has seen on the network, how long ago it last saw it, and its IP address.

2) The client can use DNS to locate a list of nodes connected to the network. One such seed is bitseed.xf2.org. The client will resolve this and get a list of Bitcoin nodes.

3) The client has a list of semi-permanent nodes compiled into it.

4) The client can connect to a well-known IRC network, irc.lfnet.org, and find other nodes that way. (This method has been removed as of version 0.8.2)

5) It takes IP addresses from the commandline (-addnode) or bitcoin.conf file (addnode=).

Step 5 in particular:

Just add in your bitcoin.conf (or yourcoin.conf) file an addnode=ip.ip.ip.ip parameter as per your nodes.

With this method you can add every kind of peer, from personal PC to server and exchanges nodes or whatever.

Hope it helps.

  • thank you, I know I could add manualy, I want to know is: the 2 users does not know the IPS so how they will connect, understand? – raduken Mar 31 '18 at 12:31
  • 1
    Edited the answer more precisely. – user51260 Mar 31 '18 at 12:36
  • thank you so much, it is a command I can type in debug mode to see the online peers? have a nice weekend – raduken Mar 31 '18 at 12:39
  • 1
    Yes, the command is getpeerinfo – user51260 Mar 31 '18 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.