lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Feature request: allow me to initialize the p2p private key file with new flag

Open barnabasbusa opened this issue 9 months ago • 7 comments

Currently the lighthouse p2p private key is stored under beacon-data/network/key binary file.

This is pretty inconvenient. It would be great if lighthouse would have a flag that would allow me to set the private key for the node using a new flag like --p2p-priv-key= that would point to a file. The content of this file is presumed to contain a hex representing Secp256 key for example e156614877adbfac274118a3be4b7dbfcd6d994126ab7e758dd7aa688f8ec0da.

Lighthouse could convert this hex to binary, so that it wouldn't become a breaking change. Then lighthouse should use this key to initialize its p2p address, which would allow us to test custom subnets for each peer.

barnabasbusa avatar Mar 20 '25 13:03 barnabasbusa

can you assign this to me!

Ayushdubey86 avatar Mar 21 '25 09:03 Ayushdubey86

Hello @barnabasbusa@michaelsproul , Check out this pr once free!

Ayushdubey86 avatar Mar 21 '25 21:03 Ayushdubey86

@barnabasbusa - What if we just used a hex encoding in our key file. You could just put whatever key you wanted into that file beacon/network/key without having to specify a new file via CLI? Or is that too cumbersome still?

AgeManning avatar Mar 24 '25 00:03 AgeManning

that’s also good, but wouldn’t that be a breaking change on your side?

barnabasbusa avatar Mar 24 '25 07:03 barnabasbusa

Yeah, kinda (we could support both formats). We do breaking changes a bit. If we just delete the old key create a new one in hex, I'm not sure anyone is really going to get upset about it, we just change PeerId's on restart, which is what Prysm does by default.

But I also like the soln @Ayushdubey86 has already made, so can go with that.

AgeManning avatar Mar 25 '25 02:03 AgeManning

Do checkout this pr once again, I have pushed further changes , @barnabasbusa @jimmygchen @michaelsproul @AgeManning

Ayushdubey86 avatar Mar 25 '25 09:03 Ayushdubey86

@Ayushdubey86 please do not tag people like this, relevant reviewers are notified of GH notifications already 🙏

dapplion avatar Mar 25 '25 19:03 dapplion

Ok, looks like we never got this solved. I"m going to revive: https://github.com/sigp/lighthouse/pull/7191, fix it so we can resolve this.

AgeManning avatar Jun 29 '25 23:06 AgeManning

I've looked at #7191 - It's incomplete and the author hasn't addressed the reviewers comments and its looks quite broken to me.

I'm going to just make a PR that reads/writes hex data from the file. It's a breaking change, but we can include it in the next release.

AgeManning avatar Jun 30 '25 01:06 AgeManning

Hopefully resolved in #7665

AgeManning avatar Jun 30 '25 02:06 AgeManning