What can we help you with?

  1. Homepage
  2. Troubleshooting Issues
  3. Accessing Your Wallet
  4. Missing Characters from Private Key

Missing Characters From Private Key

Last updated: October 26th, 2021

Credit goes to Bahk (https://github.com/domalak).

How to Use (for Beginners)

  • Click "Raw" on https://gist.github.com/tayvano/7755e3e8d8b64581d5ff2865087b93f8
  • Right click, select "Save As"
  • Click "Save"
  • Install Node.js: https://nodejs.org/en/
  • Open the .js file you saved earlier in a text editor like Notepad (PC) or Text Edit (Mac), and not using an editor such as Word.
  • Change the strings between the ' ' characters to the characters you have of your private key. Check it 5 times to be sure you got the correct characters in there:

var basePrivateKey = 'afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404'

  • Change the stuff between the ' ' characters to your address:

var targetPublicAddress = '0x06A85356DCb5b307096726FB86A78c59D38e08ee';

  • Open command line / terminal
  • Type cd into the command line, then hit the spacebar, and then drag and drop the FOLDER that contains the .js file into command line window
  • Hit enter.
  • Copy & paste the following into command line and hit enter:

npm install ethereumjs-wallet ethereumjs-util

  • Wait until it installs
  • Copy & paste the following into command line and hit enter:

node brute_force_end_of_private_key.js

You should see the following:

$ node /path/to/brute_force_8_char.js

 searching for address : 0x06A85356DCb5b307096726FB86A78c59D38e08ee
 base private key      : afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404
 missing chars         : 8
 it will be quiet now. if you don't see anything below me, it's working on finding your key.
 If you see something below that doesn't say 'FOUND KEY!', you have an error

When it's done it will show:

 ********************************** FOUND PRIVATE KEY: afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890
 matching address 0x06A85356DCb5b307096726FB86A78c59D38e08ee
  • If you see anything besides that, you have an error and it's no longer searching for your key.
  • If the error says, "Invalid private key," the key snippet you provided is invalid. It must be hex characters.
  • If you get an "out of memory" error, have to go to work, or your computer turns off, no worries. Just run it again.
  • If your command line is still open, hit the up arrow key and then enter to quickly run it again.
  • On a MacBook Pro, it will take seconds to find 1, 2, 3, or 4 missing characters.
  • It takes ~15mins to find 6 digits.
  • It will ~3 days to find 8

The code for this is here: https://gist.github.com/tayvano/7755e3e8d8b64581d5ff2865087b93f8 or below:

const util = require('ethereumjs-util');
const Wallet = require('ethereumjs-wallet');

var possible = 'abcdef1234567890';
var basePrivateKey = '1cd3b30424316919712c48359829787eefa0d724a78274a506530dbb72';
var charsMissing = 64 - basePrivateKey.length;
var targetPublicAddress = ' 0xe8Ca70C909905Ebbbe6a49c34797beF31d895241';
var missingPart = '';
for (var i = 0; i < charsMissing; i++) {
  missingPart = missingPart.concat('f');
}
var maxVal = parseInt(missingPart, 16);

console.log(
  ' \n ' +
    'searching for address : ' +
    targetPublicAddress +
    ' \n ' +
    'base private key      : ' +
    basePrivateKey +
    ' \n ' +
    'missing chars         : ' +
    charsMissing +
    ' \n ' +
    "it will be quiet now. if you don't see anything below me, it's working on finding your key." +
    ' \n ' +
    "If you see something below that doesn't say 'FOUND KEY!', you have an error" +
    ' \n '
);

function makeHexString(numb) {
  var hex = numb.toString(16);
  for (var i = 0; i < charsMissing - hex.length; i++) hex = '0' + hex;
  return hex;
}

for (var i = 0; i <= maxVal; i++) {
  try {
    var endPrivateKey = makeHexString(i);
    var privateKeyGuess = basePrivateKey + endPrivateKey;
    var wallet = Wallet.fromPrivateKey(new Buffer(privateKeyGuess, 'hex'));
    var publicAddress = util.bufferToHex(wallet.getAddress());
    // console.log(i + ": " + endPrivateKey)
    if (publicAddress.toLowerCase() == targetPublicAddress.toLowerCase()) {
      console.log(
        '\n \n \n \n ********************************** FOUND PRIVATE KEY: ' +
          privateKeyGuess +
          ' \n matching address ' +
          targetPublicAddress +
          ' \n \n \n \n '
      );
      process.exit();
    }
  } catch (e) {
    null;
  }

  if (i % 100000 === 0) {
    console.log('checked', i, 'keys');
  }
}

Didn't find what you were looking for? Contact Us

MyCrypto is an open-source tool that allows you to manage your Ethereum accounts privately and securely. Developed by and for the community since 2015, we’re focused on building awesome products that put the power in people’s hands.

© 2022 MyCrypto, Inc.

Donate

Subscribe to MyCrypto

Get updates from MyCrypto straight to your inbox!

By submitting your email, you affirmatively agree to our Privacy Policy