File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/scala/io/iohk/ethereum/crypto Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -3,19 +3,24 @@ package io.iohk.ethereum.crypto
3
3
import io .iohk .ethereum .nodebuilder .SecureRandomBuilder
4
4
5
5
/**
6
- * A simple tool to generate and ECDSA key pair. The key pair will be printed in the format:
6
+ * A simple tool to generate ECDSA key pairs. Takes an optional positional argument [n] - number of key pairs
7
+ * to generate (default is 1).
8
+ * The key pairs will be printed in the format:
7
9
* priv-key-hex (32 bytes)
8
10
* pub-key-hex (64 bytes)
9
11
*
10
12
* Run:
11
- * ./eckeygen > mantis-datadir/node.key
13
+ * ./eckeygen [n] > mantis-datadir/node.key
12
14
*
13
15
* to generate the private key for the node. Note that only the private key will be read upon Mantis boot,
14
16
* and the second line is equivalent to node ID.
15
17
* The tool can also be used to generate keys for an Ethereum account.
16
18
*/
17
19
object EcKeyGen extends App with SecureRandomBuilder {
18
- val (prv, pub) = newRandomKeyPairAsStrings(secureRandom)
20
+ val numOfKeys = args.headOption.map(_.toInt).getOrElse(1 )
21
+
22
+ val keyPairs = for (_ <- 1 to numOfKeys) yield newRandomKeyPairAsStrings(secureRandom)
23
+
19
24
// scalastyle:off
20
- println(prv + " \n " + pub )
25
+ println(keyPairs.map { case ( prv, pub) => s " $prv \n $pub \n " }.mkString( " \n " ) )
21
26
}
You can’t perform that action at this time.
0 commit comments