Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private key does not satisfy the curve requirements (ie. it is invalid #174

Open
crispy-coffee opened this issue Aug 28, 2022 · 1 comment

Comments

@crispy-coffee
Copy link

`const util = require("ethereumjs-util");
const Wallet = require("ethereumjs-wallet");

var possible = "abcdef1234567890";
var basePrivateKey =
"0x09e8568e418bcb88662b7d0094db85b24177ad68ae715dc871d07a5ef4c2a1";
var charsMissing = 66 - basePrivateKey.length;
var targetPublicAddress = " 0x3fFacFff9858168c4E0c34C6f88Eb9e6F8576c6B";
var missingPart = "";

for (var i = 0; i < charsMissing; i++) {
missingPart = missingPart.concat(i);
}

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++) {
for (var j = 0; j <= basePrivateKey.length; j++) {
// console.log(" i : " + i + " : j : " + j + "\n");
var endPrivateKey = makeHexString(i);
var privateKeyGuess = [
basePrivateKey.substring(0, j) +
endPrivateKey +
basePrivateKey.substring(j, basePrivateKey.length),
];

var wallet = Wallet.fromPrivateKey(Buffer.from(privateKeyGuess, "hex"));

var publicAddress = util.bufferToHex(wallet.getAddress());

if (publicAddress.toLowerCase() == targetPublicAddress.toLowerCase()) {
  console.log(
    `Found Private Key: ${privateKeyGuess}\n matching address \n \n \n \n`
  );
  process.exit();
}

}
if (i % 100000 === 0) {
console.log("checked", i, "keys");
}
}
`
Can Anyone help me, please? It gives me the error "throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)');" it's been 5 days of debugging the code but still no luck; please correct the code and resend it.

@jochem-brouwer
Copy link
Member

Your private keys are not 32 bytes in length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@jochem-brouwer @crispy-coffee and others