How do I remove hard coded seeds from the bitcoin source code?

0

1

I'm experimenting with blockchains at home and in my debug logs are lots of errors showing that my nodes are trying to get addresses from the hard coded seed nodes, I know I can use connect to turn off this behaviour but I don't want to have to include that in my bitcoin.conf file. I am using Bitcoin v0.10.

Any hints greatly appreciated :)

derrend

Posted 2016-04-07T04:28:51.870

Reputation: 606

If u wanna turn off the hard-coded seeds (or DNS) AND also not give explicitly the topology you wish to connect, how will u even do any p2p communication? U will need to connect to peers in some way rightvisweshn92 2016-04-07T06:00:21.870

I intend to add them manually in the config file with addnode but I keep getting annoying connection errors in my debug log. I just want to turn off the feature that tries to connect to the hard coded seeds.derrend 2016-04-07T06:14:50.957

There is a seed vector (for TestNet or Regtest) of hard-coded seeds that gets populated in the source code (vFixedSeeds in src/chainparams.cpp i guess?). U can either comment out them or simply clear the vector to empty it. Then u can explicitly have your topologyvisweshn92 2016-04-07T06:37:50.020

I appreciate the help, i have already done that though - https://github.com/derrend/bitcointemplate/blob/master/src/chainparams.cpp Im looking at src/chainparamsseed.h and share/seeds/, I think these may be what I am looking for.

derrend 2016-04-07T06:58:50.343

Please paste the error. I can help uvisweshn92 2016-04-07T07:09:30.963

Thank you viesweshn92 but the mods i made to src/chainparamsseeds have fixed my problem, I will supply a more detailed answer below later. Thanks again :)derrend 2016-04-07T07:19:32.293

Awesome then! Kindly upvote my answer/comment ;)visweshn92 2016-04-07T09:24:33.847

Answers

2

There are a few ways to do it, I personally went into src/net.cpp and commented out the if condition that triggers the lookup starting at line 1266.

// if (addrman.size() == 0 && (GetTime() - nStart > 60)) {
//     static bool done = false;
//     if (!done) {
//         LogPrintf("Adding fixed seed nodes as DNS doesn't seem to be available.\n");
//         addrman.Add(Params().FixedSeeds(), CNetAddr("127.0.0.1"));
//         done = true;
//     }
// }

Another effective fix was to remove all the encoded seed nodes from the two arrays located in src/chainparamsseeds.cpp

derrend

Posted 2016-04-07T04:28:51.870

Reputation: 606

0

There is a seed vector (for TestNet or Regtest) of hard-coded seeds that gets populated in the source code (vFixedSeeds in src/chainparams.cpp i guess?). U can either comment out them or simply clear the vector to empty it. Then u can explicitly have your topology

visweshn92

Posted 2016-04-07T04:28:51.870

Reputation: 191

0

the seed nodes are generated in contrib/seeds

curl -s http://bitcoin.sipa.be/seeds.txt > seeds_main.txt python makeseeds.py < seeds_main.txt > nodes_main.txt python generate-seeds.py . > ../../src/chainparamsseeds.h

just edit seed.main.txt

Michael Wise

Posted 2016-04-07T04:28:51.870

Reputation: 1