How to use this nodejs script (by:Raghav Sood) that have been posted on the stackexchange

How to use this nodejs script (by:Raghav Sood) that have been posted on the stackexchange

I'm new to javascript I'm trying to use this script from this post (made by Raghav Sood) :

Bruteforce bitcoin address - I know the words + public address but not the order

var bip39 = require('bip39');
var bitcoin = require('bitcoinjs-lib')

var lineReader = require('readline').createInterface({
  input: require('fs').createReadStream('addresses.txt')
});
var ctr = 1;
lineReader.on('line', function (line) {
    if (ctr%100 == 0) {
        console.log("Processing #" + ctr);
    }
    if (bip39.validateMnemonic(line)) {
        var roothex = bip39.mnemonicToSeedHex(line);
        var rootnode = bitcoin.HDNode.fromSeedHex(roothex);
        var basechild = rootnode.deriveHardened(49)
                .deriveHardened(0)
                .deriveHardened(0)
                .derive(0);
        for (var i = 0; i < 3; i++) {
            var child = basechild.derive(i);
            var keyhash = bitcoin.crypto.hash160(child.getPublicKeyBuffer())
            var scriptSig = bitcoin.script.witnessPubKeyHash.output.encode(keyhash)
            var addressBytes = bitcoin.crypto.hash160(scriptSig)
            var outputScript = bitcoin.script.scriptHash.output.encode(addressBytes)
            var address = bitcoin.address.fromOutputScript(outputScript)
            if (address == "arbitrary_btc_address_from_the_puzzle") {
                console.log("Found seed! " + line)
            }
        }
    }
    ctr++;
});

I've installed nodejs and bitcoinjs-lib,and got it working, but i'm not sure where to put the mnemonic seed words for the script to read it.

when i run the script on command prompt >node script.js it doesn't do anything.

I'm trying to solve a puzzle and i think i have the seed list but i can't figure out the order of the seed.

I would really appreciate if someone can help me figure this out.

Thank you. -Oliver-

https://ift.tt/2RS4Fo3

Comments

Popular posts from this blog

What exactly is a block?

Firmware With Unlocked Overclock for Bitmain Antminer Z9 Equihash ASIC Miners