@@ -47,19 +47,85 @@ $ nodekey-tools info --node-id e23005d5754cb0c4ca88ba99a8462e31ba8ae7b57f585db73
4747
4848```
4949
50- ### Convert a secp256k1 private key to libp2p protobuf encoded format
50+ ### Convert a hex secp256k1 private key to different formats
51+
52+ Depending on your consensus layer client, you might need one format or the other. Below is a table of the expected format for each client:
53+
54+ Client | File location | Additional flags | Key format
55+ --- | --- | --- | ---
56+ Lighthouse | ` $DATADIR/beacon/network/key ` | | binary
57+ Grandine | ` $DATADIR/network/key ` | | binary
58+ Nimbus | | ` --netkey-file=$PATH_TO_KEY --insecure-netkey-password ` | keystore
59+ Lodestar | ` $DATADIR/peer-id.json ` | | libp2p
60+ Teku | | ` --Xp2p-private-key-file-secp256k1=$PATH_TO_KEY ` | hex
61+ Prysm | | ` --p2p-priv-key=$PATH_TO_KEY ` | hex
62+
63+
64+
65+ #### binary
5166
5267``` bash
53- $ nodekey-tools secp256k1-to-libp2p --key 000bbc3112bd249176b12e0f40ecaa1ec2c6b89e8b6d9cd244e609693a891b7b
68+ $ nodekey-tools convert- secp256k1 --output-format binary --key 000bbc3112bd249176b12e0f40ecaa1ec2c6b89e8b6d9cd244e609693a891b7b --output-file key.bin
5469
55- # Output
70+ # Output file
71+ $ cat key.bin | xxd -p -c256
72+ 000bbc3112bd249176b12e0f40ecaa1ec2c6b89e8b6d9cd244e609693a891b7b
73+ ```
74+
75+ #### libp2p
76+ ``` bash
77+ $ nodekey-tools convert-secp256k1 --output-format libp2p --key 000bbc3112bd249176b12e0f40ecaa1ec2c6b89e8b6d9cd244e609693a891b7b --output-file key.libp2p.json
78+
79+ # Output file
80+ $ cat key.libp2p.json
5681{
5782 " id" : " 16Uiu2HAm9hPUmSZbyoRjQvF7T1MGh5XNYPNPcSZsrHtDBpib5PW2" ,
5883 " pubKey" : " CAISIQLUCkC2vbakeqSY6TdJqTSmpshGPaR/Q3qzWHzInIzzyw==" ,
5984 " privKey" : " CAISIAALvDESvSSRdrEuD0Dsqh7Cxriei22c0kTmCWk6iRt7"
6085}
6186```
6287
88+ #### keystore
89+ This format is prefered by Nimbus. Note, that on Nimbus you can provide the ` --insecure-netkey-password ` flag, which will use ` INSECUREPASSWORD ` as the password for the keystore file encryption. Otherwise Nimbus will prompt you for the keystore password when it runs. If you need to generate the keystore with a different password, you can do this via the ` --keystore-password ` flag.
90+
91+ ``` bash
92+ $ nodekey-tools convert-secp256k1 --output-format keystore --key 000bbc3112bd249176b12e0f40ecaa1ec2c6b89e8b6d9cd244e609693a891b7b --output-file key.keystore.json
93+
94+ # Output file
95+ $ cat key.keystore.json
96+ {
97+ " crypto" : {
98+ " kdf" : {
99+ " function" : " scrypt" ,
100+ " params" : {
101+ " dklen" : 32,
102+ " n" : 262144,
103+ " p" : 1,
104+ " r" : 8,
105+ " salt" : " 30394f01359a1ef72723295cacc448b65499d775ae731f91df742ce2733fe44a"
106+ },
107+ " message" : " "
108+ },
109+ " checksum" : {
110+ " function" : " sha256" ,
111+ " params" : {},
112+ " message" : " 391df780251bcb57fa10b5679f08e99d92dd59695b077c80d6dd559fb57b2b48"
113+ },
114+ " cipher" : {
115+ " function" : " aes-128-ctr" ,
116+ " params" : {
117+ " iv" : " 290d492a891cfa203592a4ce85765cf7"
118+ },
119+ " message" : " b47507de06419e1986dfc1dcddf79d58efbebda87d638f98c8bd1b290f8cebe5fa18eb70"
120+ }
121+ },
122+ " pubkey" : " 0802122102d40a40b6bdb6a47aa498e93749a934a6a6c8463da47f437ab3587cc89c8cf3cb" ,
123+ " uuid" : " 2e00d87c-7fe9-4998-9243-7454195508f2" ,
124+ " version" : 1
125+ }
126+ ```
127+
128+
63129
64130### Generate nodekeys for a DAS network
65131
@@ -71,8 +137,9 @@ This will generate 18 nodekeys across a 128 column network and save them to the
71137# Try 18 nodes first. This should be quite fast to generate.
72138$ nodekey-tools generate-network --node-count 18 --column-count 128 --output-file result-18.json
73139
74- # If you want the "optimal" size of 16 (128 columns / 8 columns per node) then you can run
75- # the following command. This can take hours/days.
140+ # If you want the "pefect" size of 16 (128 columns / 8 columns per node), so that each column is
141+ # served by a single node, then you can run the following command.
142+ # Note that this can take hours/days. ( ~ 10 days when mining 4 million keys/sec ).
76143$ nodekey-tools generate-network --node-count 16 --column-count 128 --output-file result-16.json
77144```
78145
0 commit comments