2

I have a script to setup a geth Ethereum node which has worked well for me most of the time. (been using it for the last 2-3 weeks). I have used it regularly to setup multiple geth instances on different docker instances.

However, today, when I created some nodes on different docker instances (all running on same box), I saw issues. For starters, the 2 nodes are unable to talk to each other when I use admin.addPeer(). Mining doesnt work either. On investigation, I figured out all the nodes created have the same enode id.

This is a bizzare issue - seeing it for the first time. I made no changes in my script or how I start the multiple geth instances. Anything I can do to prevent this? I tried using bootnode also as follows -

bootnode -genkey boot.key
bootnode -nodekey boot.key

INFO [10-11|08:51:32.325] UDP listener up                          self=enode://e3e9eec5fad93a169f7667905733d831f9e6c9ad233fcf2430dd65d8822c688310784f1b3c8bba38e1037bab1916b1e755124ff6973d752fed8912c6e2ba2569@[::]:30301

I expect to see the above id picked up when I do geth --bootnodes

However, I see something totally different.

Any suggestions.

Thanks!

1 Answer 1

2

The enode is calculated based on the nodekey value. If all your nodes refer to the same datadir, or you bootstrapped multiple instances by copying the data dir, then they will have the same enode ID.

Delete the datadir/geth/nodekey file, which should be at ~/.ethereum/geth/nodekey by default, then restart your nodes. They will generate new, random keys, and get different enode IDs.

1
  • Thanks! this worked. Regenerated the nodekey everytime. However, I am a little surprised how it worked everytime before this.
    – Omi
    Commented Oct 12, 2018 at 4:33

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.