2

Recently I came across my old keystore file from the original Ethereum Wallet that I used back in 2017. Unfortunately I cannot find the private key or password for that wallet anymore, big problem of not writing it down on a piece of paper and save that... The issue is that I am hoping to recover the private key from my keystore file with coding or another way. I have been trying to look it up but couldn't find something useful so far. Is there anyone who knows a way to recover the private key from your keystore file without the password?

2
  • BTW, it's 'keystore', not 'keystone'. Jan 5, 2021 at 15:55
  • It cannot be done without password, you can try to hack the password it could be easy if u know your password pattern (maybe mask attack or guess itpro.co.uk/security/34616/…) however it will probably take a lot of time and effort
    – Majd TL
    Jan 5, 2021 at 16:39

1 Answer 1

5

Private key recovery instructions:

  1. Download and install NodeJS
  2. Create a new folder, and:
    • Copy your key-store file into this folder
    • Create a new file called run.js in this folder
  3. Open a command-line terminal in this folder, and run:
    • npm install keythereum
    • node run.js

Contents of run.js:

const fs = require("fs");
const keythereum = require("keythereum");

const KEYSTORE = "KeystoreFileName";
const PASSWORD = "YourPassword";

const keyObject = JSON.parse(fs.readFileSync(KEYSTORE, {encoding: "utf8"}));
const privateKey = keythereum.recover(PASSWORD, keyObject).toString("hex");
console.log(`0x${keyObject.address}: 0x${privateKey}`);

In the code above, replace:

  • The string "KeystoreFileName" with the key-store file name
  • The string "YourPassword" with your password
5
  • Thanks for your comment! Only(and big) issue is that I also do not know my password anymore so that is why I am trying to find a way to access my wallet with only the keystore file.
    – Swinks95
    Jan 5, 2021 at 20:05
  • @Swinks95: If you have any vague idea about your password, then you can try several options using the script above, until "0x" + keyObject.address === YourWalletAddress. Jan 5, 2021 at 20:10
  • In which environment do I have to do all this? I normally work with python in juptyer but I am not familiair with NodeJS
    – Swinks95
    Jan 5, 2021 at 21:00
  • @Swinks95: The above code is in NodeJS, as explicitly stated in the answer. But assuming that you do have a few combinations in mind that you can iterate on, it shouldn't be much of a problem in Javascript. Jan 5, 2021 at 21:02
  • thanks for sharing your inputs here. Sorry for reaching you out of the blue. I was wondering if you could assist me with this. I am kind of not finding any information anywhere else. ethereum.stackexchange.com/questions/118130/… Thanks a ton in advance. Jan 6, 2022 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.