Skip to content

Instantly share code, notes, and snippets.

@Alex-Werner
Last active November 3, 2017 13:08
Show Gist options
  • Save Alex-Werner/9fc45eaf42db5bc93bac054610f82c4b to your computer and use it in GitHub Desktop.
Save Alex-Werner/9fc45eaf42db5bc93bac054610f82c4b to your computer and use it in GitHub Desktop.

Revisions

  1. Alex-Werner revised this gist Nov 3, 2017. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -30,5 +30,14 @@ node.on('ready',function(){
    });
    });
    dashd.on('block',function(block){console.log(block)});
    dashd.on('tx',function(tx){console.log(tx)});
    dashd.on('tx',function(txData){
    let tx = new bitcore.lib.Transaction(txData).toJSON();
    let inputs = tx.inputs;

    inputs.forEach(function(input){
    let script = new bitcore.lib.Script(input.script);
    let address = script.toAddress('testnet');
    //Enjoy potato with address
    })
    });
    });
  2. Alex-Werner created this gist Oct 14, 2017.
    34 changes: 34 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    const bitcore = require('bitcore-node-dash');
    const start = bitcore.scaffold.start;
    let config = {
    "network": "testnet",
    "port": 3001,
    "services": [
    "bitcoind"
    ],
    "servicesConfig": {
    "bitcoind": {
    "connect": [{
    "rpchost": "127.0.0.1",
    "rpcport": 9998,
    "rpcuser": "dash",
    "rpcpassword": "local321",
    "zmqpubrawtx": "tcp://127.0.0.1:28332"
    }]
    }
    }
    };

    let node = start({path:"",config:config});
    node.on('ready',function(){
    console.log('Hey I\'m ready!')
    let dashd = node.services.bitcoind;
    dashd.getBestBlockHash(function(err, hash){
    if(err){console.log(err);}
    dashd.getBlockHeader(hash,function(err, info){
    console.log(info);
    });
    });
    dashd.on('block',function(block){console.log(block)});
    dashd.on('tx',function(tx){console.log(tx)});
    });