2

Every time I stop and re-start Geth, I wait for it to discover peers. Can I instead export my list of currently connected peers and use them as bootnodes in my next start? I know this list will act as a central peer database but still, more peers should mean more safety, right? I would really appreciate a code snippet for this.

Thanks,

2 Answers 2

5

As i know there is not built in option to do so, however you could do it using a script : i am trying here to give you some response elements. the following snippet to output all the connected peers

admin.peers.forEach(function(value){console.log(value.id+"@"+value.network.remoteAddress)})

you need to write a script which read the outputs and use them as bootnodes

1
  • Great! Thanks. Maybe we need to write (or append) them to a file and read them later to construct the --bootnodes flag. I will try this and share if I succeed. Thanks again for the help!
    – jeff
    Commented Apr 29, 2017 at 20:46
1

With the current version of geth, peers already contains enode then we can simply export peers by below javascript code snippet

admin.peers.forEach(function(value){console.log(value.enode)})

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.