KeyStone
← What I can and cannot recover

Ethereum · Keystore JSON

Recovering an Ethereum keystore JSON password

This is the toughest of the four formats, and it is worth knowing before spending money: the standard keystore uses scrypt with parameters designed so that trying a single password costs nearly a second. Here an honest diagnosis matters more than anywhere else.

What it is called and what it holds

It is a text file with a long name, like UTC--2017-06-11T09-22-41.000Z--a1b2c3…, and inside it carries JSON with the encrypted private key in crypto.ciphertext, the derivation function in crypto.kdf, its parameters in crypto.kdfparams and a mac that lets you check whether a password is the right one. It is produced by geth, MyEtherWallet, MyCrypto and just about any tool that gave you a “wallet file” for Ethereum.

Open it in a text editor and tell me only these values: whatever appears under kdf, and the numbers in n, r, p, c and dklen. They are not secrets, they grant access to nothing, and with them I know the exact cost per guess. That is half the diagnosis and I can give it to you the same day.

The parameters decide everything

What the file saysWhat it meansGuesses per second
kdf: scrypt, n: 262144Standard parameters: 256 MiB of memory per guess1 – 10
kdf: scrypt, n: 4096“Light” parameters, used by some mobile wallets10² – 10³
kdf: pbkdf2, c: 262144No memory cost: a GPU does help here10³ – 10⁴

The difference between the first row and the third is three orders of magnitude, and it depends on neither you nor me: it was set by whatever tool generated the file. With standard scrypt, a space of a million candidates is days of compute; with ten million, it is not.

When there is a way out

  • You remember the password in pieces and the candidate space stays in the thousands or tens of thousands.
  • The file uses “light” parameters or pbkdf2, in which case far more guesses fit.
  • You have three or four specific candidates: trying them takes minutes even with standard scrypt.
  • It was a variant of a password you still use or remember.

When there is not

  • scrypt with standard parameters and no clue about the password. At one to ten guesses per second, even a million candidates is weeks; eight random characters are hundreds of thousands of years.
  • You lost the file. The password without the keystore is worth nothing.
  • The JSON is incomplete or missing its mac: without it there is no way to verify whether a password is right.
  • You cannot prove the wallet is yours.
The keystore is already encrypted, so it can travel by email as an attachment. Your candidate passwords cannot: those are read out on a video call. It is explained in how a case runs.

Other formats