Skip to content

Instantly share code, notes, and snippets.

@swaldman
Last active June 5, 2017 18:53
Show Gist options
  • Save swaldman/0df034f7d4f1384614e8cfc15a544eda to your computer and use it in GitHub Desktop.
Save swaldman/0df034f7d4f1384614e8cfc15a544eda to your computer and use it in GitHub Desktop.
an eth-command-line keypair example

So, usually you generate wallets, not keypairs directly, to avoid exposing the ultrasensitive private key directly. But if you just want to get a keypair, here's an easy way with some of the tooling I'm working on.

Prerequisite: Java 8 installed on your machine.

Caveats: No warranties, if anybody gets or sees the private key any value associated with the keypair may be stolen, the entropy behind the generation of these keys is the default implementation and seeding of java.security.SecureRandom, which may or may not be adequate. This is a SNAPSHOT version that references lots of other SNAPSHOT libraries, which may not be stable and will be redownloaded with annoying frequency until (hopefully soon) it is upgraded to a release version.

The "eth-command-line" project is really just a customized sbt interactive shell. If you are familiar with sbt, all your tricks will work.

Without further ado...

$ git clone git@github.com:swaldman/eth-command-line.git
Cloning into 'eth-command-line'...
remote: Counting objects: 55, done.
remote: Total 55 (delta 0), reused 0 (delta 0), pack-reused 55
Receiving objects: 100% (55/55), 16.00 KiB | 0 bytes/s, done.
Resolving deltas: 100% (29/29), done.
$ cd eth-command-line/
$ ./eth-command-line 

The first time you execute this, it will download lots and lots of libraries. Most of these will be downloaded just once, but several of the libraries are "snapshot" releases, and these will be annoyingly rechecked with great frequency and downloaded whenever they have been updated. (This will stop happening when things stabilize to a release.)

At the end of a lot of ceremony, you'll see a prompt:

eth-command-line ~>

To get a keypair printed on the console:

eth-command-line ~> show xethGenKeyPair
[info] Generated keypair for address '0xc0feaca0c57676f69317f351b14a1dc7aeb5a6ee'
[info] EthKeyPair(EthPrivateKey(ByteSeqExact32(0x83303b5fb489061cb0c283d4765723362387692b47d69a40e68bcd0954b2af4e)),EthPublicKey(ByteSeqExact64(0xf8edca00c4def093927c21d5855a24f15a2780bf8ad4100a3ad681ce940c25e56c421b29c61d762392a68809eee6f53e7006d68be6e919c064fb32f7e741883c)))

That's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment