Skip to content

Instantly share code, notes, and snippets.

@ghoti143
Last active March 29, 2018 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghoti143/a7d059af8f30ab508b69f9fb5775e09c to your computer and use it in GitHub Desktop.
Save ghoti143/a7d059af8f30ab508b69f9fb5775e09c to your computer and use it in GitHub Desktop.
gen eos priv key using eosjs-ecc
npm i eosjs-ecc

node

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

// Create a new random private key
let privateWif
PrivateKey.randomKey().then(privateKey => privateWif = privateKey.toWif())

// Convert to a public key
pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()

tested with npm version 5.6.0 and node version 9.9.0. may work with others, but no guarantees.

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