Securely Generating an EOS Public / Private Key Pair Using Official EOS.IO Code

Kevin Rose
EOS New York
Published in
3 min readApr 5, 2018

There are many ways to generate an EOS public / private key pair. Even though there are many third-party options, it is understandable that to be extra cautious about using something not provided by the official EOS.IO team.

The method described in this video relies only on code and commands sourced from the EOS.IO GitHub organization. While it does require having to execute some JavaScript code, our Lead Software Engineer, Mike Haggerty, meticulously walks through each step to allow non-programmers to perform this important function.

The code used in this video: https://github.com/EOSIO/eosjs-ecc

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 1. Open command prompt / terminal
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Windows: https://www.wikihow.com/Open-the-Command-Prompt-in-Windows

Mac: https://www.wikihow.com/Open-a-Terminal-Window-in-Mac

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 2. Check if Node.js is installed
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ node -v
$ npm -v

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 3. Download Node.js (if needed)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

https://nodejs.org

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 4. Setup workspace
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ mkdir eos_keypair
$ cd eos_keypair

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 5. Download eosjs-ecc NPM package then turn off Wi-Fi
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ npm i eosjs-ecc

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 6. Start Node.js interactive shell
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ node

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 7. Execute “four commands”
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The “four commands” listed on the eosjs-ecc README: https://github.com/EOSIO/eosjs-ecc#usage-object-api

>let {PrivateKey, PublicKey, Signature, Aes, key_utils, config} = require(‘eosjs-ecc’)

>let privateWif

>PrivateKey.randomKey().then(privateKey => privateWif = privateKey.toWif())

>pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()

=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 8. Output private key
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

>privateWif

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Step 9. Register public key
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Link Here

Special thank you to @eosdac for helping us ensure our work is 100%.

EOS New York is a Block Producer Candidate. Always Adding Value. Everything a Block Away.

Website
Twitter
Medium
STEEM
Meetup
Youtube

--

--

Kevin Rose
EOS New York

Former EOS Block Producer. Now Windranger / BitDAO