[Ethereum] Go Ethereum – get the enode before starting geth

ethergo-ethereumgolang

I need to get the enode of my geth nodes before I start them up.. is there any way to do this via a command other than actually starting up the node ?

Best Answer

Using node hex in nodekey file under .ethereum/geth/nodekey and bootnode utility.

Assuming you are using Linux.

Check your nodekey hex :

$ cat ~/.ethereum/geth/nodekey
2ad3a9ccd99926514e77501c33c5fdbae6ecfdc6fc82853bc8f28772b13cd2df

Then with bootnode utility :

$ bootnode -nodekeyhex 2ad3a9ccd99926514e77501c33c5fdbae6ecfdc6fc82853bc8f28772b13cd2df -writeaddress
565f2cd2c5fd4f8798daaa65c858e4040d2b0db31b7d354177e126b34fea6163194c926a1cf3ffa1be29252518d6217a114479703e0f01ba5642a7d3bdc1137e