In the options for geth I see --nodekey listed but I can't seem to get it to (re)generate an enode url when starting a full node. When starting a bootnode this works for me as expected.

So should geth --nodkey=key.txt" be (re)generating the same enode like I'm expecting or does that only work with bootnode --nodkey=key.txt?


Yes geth --nodkey=key.txt will (re)generate the same enode url repeatedly as the cli options would suggest. It wasn't working for me due to the unfortunate combination of a typo in my sh script and a bad nodekey file.



> admin.nodeInfo
  enode: "enode://44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d@[::]:30303",
  id: "44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d",
  ip: "::",
  listenAddr: "[::]:30303",
  name: "Geth/v1.5.0-unstable/linux/go1.6",
  ports: {
    discovery: 30303,
    listener: 30303
  protocols: {
    eth: {
      difficulty: 17334254859343145000,
      genesis: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
      head: "0xb83f73fbe6220c111136aefd27b160bf4a34085c65ba89f24246b3162257c36a",
      network: 1

when starting you node, the enode is also printed during the startup process

  • I reworded my question to be clearer. I'm trying to use geth like bootnode to get a consistent enode. Feb 10 '18 at 20:41
  • the enode is deterministic and will not change. The IP of your node might change if it's a dynamic one though. So start your geth node you wanna use as a bootnode. Save the enode (copy-past works perfect) in a file. Then start a second node with the option --bootnodes 'enodeOfYourGethNodePreviouslySaved@itsIp:itsPort'
    – salanfe
    Feb 10 '18 at 22:03

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.