3

I have been developing a web app and used many autogenerated ETH addresses. I stored all of them into one folder in the next format:

/storage
  123456789/
    mainnet.eth.privateKey:
      "0xdeadbeefdeadbeef...deadbeef"
    mainnet.btc.privateKey
      "Kw123123123...AbCDeF"
  .../

Where the dir is always some generated number, and it stores raw private keys (WIF for bitcoin).

During development, I have used a few addresses to store real ETH. But unfortunately, I haven't keep track of the IDs for those addresses. And one of this addresses now has some amount of ETH which would be nice to get back.

However, the amount of directories is overwhelming (over 100 at least), because they've been autogenerating for each launch if not provided.

Still, I am pretty sure it sits on one of the machines I have been developing on. Of course, Now I can go through them manually, checking one by one, but that would be too long, in the end, there is no millions locked.

So the question is if there is any utility that automatically searches a private key and matches address to given address or a tool that just checks a balance for any string that looks like private key?

Maybe there exists a command line snippet to check balance for found private-keys-alike string?

1

1 Answer 1

2

It seems like web3 should be able to get the job done for you via accounts.privateKeyToAccount(privateKey). It accepts a private key string then returns an object which includes the associated address. Remember that an Ethereum address is a deterministic function of the private key, so if you've got the private key, you've got the address.

Your overall solution here is probably writing a node.js script which iterates over every file in the directory, checks whether each key has a balance, then sends it to an address of your choice if so.

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.