2

I have an Ethereum node on a Amazon AWS instance. When I clone my node, it will generate with the same enode-ID. When both machine try to connect to peers, they get race each other, so one of them able to connect to peers but other cannot.

[Q] How could I change my enodeID on using geth?

Solution for Parity node:

Changing or removing the network key changes the enode address:

~/.local/share/io.parity.ethereum/network/key You could increment the value by one or generate a new one or remove it and parity will take care of that.

I don't know how to do this approach on geth.

7
  • As long as they're both running on a different IP address / port their enode IDs will be unique - or have I misunderstood your question?
    – TC8
    Mar 20, 2018 at 17:32
  • They are not. First nodeA initialized the genesis block and sync the blockchain. later when I clone that nodeA into nodeB, nodeB has the same enodeID. @TC8
    – alper
    Mar 20, 2018 at 17:43
  • here's an example enode ID: enode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e140724[email protected]:30303?discport=30301 i.e. a hexadecimal ID followed by an IP address and port number. If you run two nodes you'll need them on distinct IP/port combinations or they won't work properly. By changing the port number of one of them you won't change the hexadecimal part of the enode string but you will change the port numbers at the end, which should be all you need to avoid conflict
    – TC8
    Mar 20, 2018 at 17:47
  • You didn't understand my question I guess. Both have different IP and Port, but both has same initialization. When I clone a node , its node's enode-ID is not updated. @TC8
    – alper
    Mar 20, 2018 at 17:49
  • I understood the question but my idea for the solution must be wrong so please feel free to ignore me :)
    – TC8
    Mar 20, 2018 at 17:50

1 Answer 1

4
+25

By default, Geth's key file is: ~/.ethereum/geth/nodekey for Linux Library/Ethereum/geth/nodekey for Mac

More details can be found in geth source code here for the definition:

datadirPrivateKey = "nodekey" // Path within the datadir to the node's private key

And this line for path resolution.

3
  • Should I delete ~/.ethereum/geth/nodekey ? @Linmao Song
    – alper
    Mar 28, 2018 at 11:12
  • 2
    Yes, if you delete it and restart geth, it will generate a new one Mar 28, 2018 at 11:37
  • On the latest geth version nodekey file is located in /private/geth
    – alper
    Nov 18, 2020 at 20:58

Your Answer

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

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