Skip to content

Instantly share code, notes, and snippets.

@lakshmankashyap
Created March 9, 2018 11:31
Show Gist options
  • Save lakshmankashyap/2b540bdeed764d78c08a50d3cfd1d2a9 to your computer and use it in GitHub Desktop.
Save lakshmankashyap/2b540bdeed764d78c08a50d3cfd1d2a9 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