3

How do I run my own bootstrap node? I mean how do I make my geth only provide peers information not the blockchain. And also how does geth know whether a node is a bootstrap node or regular node? Becz without knowing the difference geth will start requesting the blockchain to the bootstrap node.

The command line option bootnodes let's us add bootstrap nodes and the JavaScript addPeermethod let's us add regular nodes. So if I add a regular node using bootnodes than won't my geth instance request the blockchain from the bootnode?

5

The executable to run a bootnode is bootnode. In Ubuntu, this installed alongside /usr/bin/geth in /usr/bin/bootnode.

You will have to generate a key to run your bootnode:

user@Kumquat:/tmp$ bootnode -genkey nodekeyfile
user@Kumquat:/tmp$ cat nodekeyfile 
3bed8e0fa771475049cddac0fcc20a6cf1005e271e2b12ef339f213218b2dbdb
user@Kumquat:/tmp$ bootnode -nodekey nodekeyfile 
I1001 23:17:42.874776 p2p/discover/udp.go:217] Listening, enode://d3b75b24a4fd718b1358d28ba576b2e98f73a7465326c4504f21cc0d124466a91919de18fb72a634f9108f0eedd5ef943aea5c250b41c974c4a7fb7c159b9968@[::]:30301

In a separate window, I ran the netstat command to view the UDP 30301 port that bootnode is listening on:

user@Kumquat:/tmp$ sudo netstat -anp | grep boot
[sudo] password for user: 
udp6       0      0 :::30301                :::*                                8317/bootnode   

This bootnode program only serves as a bootstrapping node and will not provide any blockchain data transfers.

You should now be able to use enode://d3b75b24a4fd718b1358d28ba576b2e98f73a7465326c4504f21cc0d124466a91919de18fb72a634f9108f0eedd5ef943aea5c250b41c974c4a7fb7c159b9968@[::]:30301 as your geth --bootnodes parameter value, where you replace [::] with the IP address of your bootnode computer.



Update

If you have issues getting the peer-to-peer discovery to work, add the --verbosity 6 before the console parameter of geth. You should see the communications to the bootnode in action.

You can also add the verbosity parameter to the bootnode command:

user@Kumquat:/tmp$ bootnode -nodekey nodekeyfile -verbosity 9
I1001 23:17:42.874776 p2p/discover/udp.go:217] Listening, enode://d3b75b24a4fd718b1358d28ba576b2e98f73a7465326c4504f21cc0d124466a91919de18fb72a634f9108f0eedd5ef943aea5c250b41c974c4a7fb7c159b9968@[::]:30301
I1001 23:39:12.546003 p2p/discover/udp.go:453] >>> 192.168.1.14:54991 discover.pong
I1001 23:39:12.546145 p2p/discover/udp.go:521] <<< 192.168.1.14:54991 *discover.ping: ok
I1001 23:39:12.546226 p2p/discover/database.go:183] failed to retrieve node b68ed408e685e6dc75ea457b65f945fa2c6f2171c8bfaf26e32d6362c3ebe9ed3ef3aeb682991e3a01250f93f2a68ea8ca1a98676e669cc007ed227c35d7c3f1: leveldb: not found
I1001 23:39:12.546337 p2p/discover/table.go:473] Bonding b68ed408e685e6dc: known=false, fails=0 age=409813h39m12.54632801s
I1001 23:39:12.547012 p2p/discover/udp.go:453] >>> 192.168.1.14:54991 discover.ping
I1001 23:39:12.549582 p2p/discover/udp.go:521] <<< 192.168.1.14:54991 *discover.pong: ok
I1001 23:39:12.556974 p2p/discover/udp.go:453] >>> 192.168.1.14:54991 discover.neighbors
I1001 23:39:12.557059 p2p/discover/udp.go:521] <<< 192.168.1.14:54991 *discover.findnode: ok

And the latest P2P discovery protocol documentation can be found at RLPx: Cryptographic Network & Transport Protocol.

  • I think the devp2p protocol is missing the capabilities info. I think the node should declare if it is bootnode or not. – Sentinel Jun 30 '17 at 7:22

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.