2

I'm testing a new altcoin that I've created between several computers in LAN but encounter a situation as follow:

Computer A's client connects to computer B's client through the B's IP in the addnode field in the config file and only B's IP is specified in it. The same thing happens between B and C as C only knows B through the config file. It seems that there is no connection between A and C since the the command getpeerinfo in both A and C doesn't show the other's IP. Indeed, when I shut down the client on computer B, the two clients on A and C become disconnected to the network.

So my question is: what should I do to make A and C connected since they share a common peer's connection? (assuming that the new common connections are random, not known in advance to be included in the config file)

I've read somewhere that there are seed nodes which stores IPs of clients which have connected to them and that they usually don't need to keep connecting to those new nodes, just save the addresses in the database and disconnect. In case of new peer connects to the network, those seed nodes will help to provide list of peers' IPs. So how can I configure a node to be a seed node? Is it in this case the DNS seed? (I guess it's not)

Thank you in advance and all kinds of help will be highly appreciated.

1 Answer 1

1

The basic problem you need to solve is this: B knows about other nodes on the network, and needs to inform A of this. So, your coin's protocol will have to include some way for this to happen.

In Bitcoin, node A would send a getaddr message to B, and B would respond with an addr message, listing other nodes it knows about (in this case, C). Then A can try to connect directly to these nodes. See https://en.bitcoin.it/wiki/Protocol_documentation for more information about these messages. If you started with the Bitcoin source for your altcoin, then you should investigate why this isn't happening.

A seed node is a special case of this, to handle the situation where a brand-new client doesn't yet know about any other nodes on the network. Someone promises to operate a node that should stay working reliably and be available at a specific IP address or DNS name (a so-called DNS seed). This address or DNS name can then be hard-coded in the client source code, so that new clients will try that node first. See What is a DNS seed node vs a Seed Node?. Using the getaddr/addr protocol, the seed node can then inform the client of other nodes. Once the client connects to some of those nodes, it can find out about additional nodes, and so on until the client reaches whatever connection limit it has configured.

In some cases the seed node might be configured to only respond to getaddr requests and not to any other type of request, so that it does not get overloaded with relaying blocks, transactions, etc, and stays available for its main job of helping clients find each other.

2
  • Thank you very much, Nate! It's exactly what I've read in Mastering Bitcoin that A should receive B's nodes which includes C but it doesn't work the same in my case. In addition, I started with Litecoin source code so there may be some changes in Litecoin related to this problem, I'm gonna look up more about this. Speaking about seed node, can you give me more specific info such as how to configure my client to only respond to getaddr, we will have to code or it is just about edit settings like maxMoney, rpcport,...?
    – hoanghs13
    Commented Nov 18, 2016 at 3:35
  • @hoanghs13 Did you finally manage to set the seeder node? I'm trying to do the same, but apparently the only viable way is to set up a DNS seeder.
    – FedFranz
    Commented Sep 29, 2017 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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