How to generate securely and verify your EOS keys with official tools

in eos •  7 years ago  (edited)

I know BlockOne added a tool online, I know some developers did a nice Web page but you shouldn't trust the browser or an external developers to generate a private key!!!

Schermata da 2018-05-22 18-05-19.png

You can still update your EOS address in the smart contract before the mainnet launch of june.

1. Install NodeJS

it's available for Linux, Mac and Windows. https://nodejs.org/en/

2. Install eosjs-ecc to generate the EOS keys with JavaScript

Open a terminal and type:

npm install eosjs-ecc

It comes from the official EOSIO github project https://github.com/EOSIO/eosjs-ecc

Now you can turn OFF the Wifi or the internet connection and type:

node

3. Generate an EOS private key

Cut and paste this, to generate a new keypair

let { PrivateKey } = require('eosjs-ecc')

PrivateKey.randomKey().then(privateKey => {
  let privateWif = privateKey.toWif()
  let pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()

  console.log(`
    EOS private: ${privateWif}
    EOS public: ${pubkey}
  `)
})

4. Verify an EOS private key

Add your private key and cut and paste this to verify it

let { PrivateKey } = require('eosjs-ecc')

function verify(privkey) {
  return PrivateKey.fromWif(privkey).toPublic().toString()
}

// PUT BELOW YOUR PRIVATE KEY
var privkey = '5K4zLkAZGWTK7xZpYoy2NLT6nUNSnhDZqLSDRM7WhuXatKzaPUA'
console.log(`
  EOS public: ${verify(privkey)}
`)

Congratulation! If the output is the public key you have everything is fine!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

That's very useful ! Do you have a course that teaches something like that ? Even in Italian I understand the language.

Hi, a course about what? Just a basic terminal knowledge is required to do these steps: terminal and cut and paste :)

Nice article, it is great we are sharing multiple options with the community, keep it coming.

You got a 11.76% upvote from @redlambo courtesy of @luigi-tecnologo! Make sure to use tag #redlambo to be considered for the curation post!

Great info! Would it also be able to vote and stake this way?

No this is only to generate safe private keys. Vote and staking, I think will be done via cleos or a more user friendly interface based on eosjs https://github.com/EOSIO/eosjs

That's a very advanced approach... and safe. Well done!