Skip to content

Instantly share code, notes, and snippets.

@lakshmankashyap
Last active March 14, 2018 19:21
Show Gist options
  • Save lakshmankashyap/b3559ebaf1ac383fd264d08f88166db2 to your computer and use it in GitHub Desktop.
Save lakshmankashyap/b3559ebaf1ac383fd264d08f88166db2 to your computer and use it in GitHub Desktop.
Recover Ethereum keystore using the private key and keystore password

/bin/node

// https://github.com/ethereumjs/ethereumjs-wallet
// -> npm install ethereumjs-wallet
var Wallet = require('ethereumjs-wallet');

var privateKey = '-> your private key here <-'; // in hex format
var keystorePassword = '-> your keystore password here <-';

var wallet = Wallet.fromPrivateKey(Buffer.from(privateKey, 'hex'));
var keystore = wallet.toV3String(keystorePassword, { n: 1024 });

console.log(keystore);

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