Open fearlessfe opened 6 days ago
@GrapeBaBa please assign me
The public key of the node is used to form its ID. The private key, according to PortalNetworks is used to prevent impersonation:
Nodes generate a private key for the purpose of node discovery. This is used to sign the ENR to prevent impersonation. Peers can encrypt messages for each other using the ENR.
then it should be ideally password protected.
My purpose is to use the file "nodekey" in data.dir
directory to store the private key not encrypted, and create a new flag --nodekey.file
with value <file name>:<password>
.
The usage is the follow:
--nodekey.file
is omitted
1.1 - when starting, Shisui looks for a key in the file "nodekey", if there is not it creat a new private key
1.2 - when quitting, if the file "nodekey" do not exist Shisui create the file and saves the private key--nodekey.file <file>:<password>
is present
2.1 - when starting, Shisui looks for a key in the password protected file \<file>, if there is not it creat a new private key
2.2 - when quitting, if the file \<file> do not exist Shisui create the file and saves the private key with password protection This is my idea, any feedback is welcome!
EDIT: note that --private.key
should be removed in this proposal
I think we can just store the key in the datadir, such as geth and trin(another portalnetwork client impl by rust) do
Rationale
Why should this feature exist?
Every time you run shisui client, it will generate a private key for the client even if you restart the client. That means every time you start a client, it will be a new node.
Implementation
Do you have ideas regarding the implementation of this feature?
Try to read the key in data dir, If the key path is not exist, create a new key, or read key from file