MyEtherWallet / etherwallet

https://vintage.myetherwallet.com
MIT License
2.35k stars 1.72k forks source link

Re-Download encrypted keystore file #1163

Open ghost opened 6 years ago

ghost commented 6 years ago

I fucked up my encrypted keystore file (which you have to download upon wallet creation). So basically I don't have it any more. It was not that bad because I have a backup of my private key, so I was able to access my wallet with my private key.

But it would be nice if this is coded right into MyEtherWallet, so anyone can re-download his encrypted keystore.

This is my code:

#!/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);
janderholm commented 6 years ago

This would be great! It opens up possibilities like generating your own private key using dice while not having to rely on an plain text private key.