nuriel77 / hornet-playbook

Ansible Playbook for Hornet IOTA Full Node
MIT License
67 stars 11 forks source link

Set node Peer ID #51

Closed jeliasson closed 2 years ago

jeliasson commented 2 years ago

I accidentally ran Set node Peer ID in horc and that, without confirmation prompt, tried to re-generate new peer ID and it's key. Unfortunately, it looks like gohornet/hornet image has changed command line for p2pidentity from tools p2pidentity to tools p2pidentity-gen. As a result, the private key and peer id is malformed.

$ sudo cat /opt/hornet-playbook/group_vars/all/z-installer-override.yml
[...]
hornet_config_p2p_identityPrivateKey: toolnotfound.
hornet_config_p2p_identityPeerID: appliesthelatestmilestoneinthedatabasetothecoordinatorstatefile

Running the command manually

/usr/bin/docker run -it --rm --name getp2pID "gohornet/hornet:1.1.3" tools p2pidentity
tool not found.

pwd-hash:            generates a scrypt hash from your password and salt
p2pidentity-gen:     generates a p2p identity private key file
p2pidentity-extract: extracts the p2p identity from the private key file
[...]

Running the command with p2pidentity-gen

/usr/bin/docker run -it --rm --name getp2pID "gohornet/hornet:1.1.3" tools p2pidentity-gen
Your p2p private key (hex):    08390b13f0f113ce6470b923a0a40669cd[...]
Your p2p public key (hex):     80fac4b8f6c[...]
Your p2p public key (base58):  9gUy3J7j7[...]
Your p2p PeerID:               12D3KooWJVr[...]

I have not digged into much depth, but it looks like this breaks the current version. Further more, variables PRIVATE_KEY and PEER_ID might need to be reconstructed.

https://github.com/nuriel77/hornet-playbook/blob/da805c42240cd20ccffe728baabba937f944d456/roles/hornet/files/horc#L1391-L1395

@nuriel77 Please let me know if you see this as a bug, and if you'd like some help addressing it in a PR. Also, can you kindly let me know if there is any backup being done in the original setup process.

Thanks!

nuriel77 commented 2 years ago

@jeliasson thank you for opening the issue.

I believe that the identityPrivateKey was removed in hornet 1.0.5 Do you want to open a PR to remove all the p2pidentity code from the hornet-playbook?

If so, that would be great! That includes the code snippet you've shown (and menu items) and also this code.

I don't think there's a need for this anymore. I believe that users ought to backup their databases directories should they desire to keep their node's ID.