Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var utils = require('ethereumjs-util');
// private key as argument
console.log("Argument: " + process.argv[2]);
function hexToBytes(hex){
var bytes = [];
for(var i=0; i<hex.length;i+=2){
return bytes;
var privateKeyToAddress = function(privateKey){
var addr = utils.privateToAddress(hexToBytes(privateKey)).toString('hex');
return '0x'+addr;
console.log('Generated Public Key: ' + privateKeyToAddress(process.argv[2]));
// get the public key from the private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.