Saturday, July 6, 2024

bitcoind – how to hook up with bitcoin node in javascript with out operating a neighborhood node

I’m attempting to get some bitcoin community information and I’m utilizing bitcoind-rpc library.
If i simply run their instance:

var run = operate() {
  var bitcore = require('bitcore');
  var RpcClient = require('bitcoind-rpc');
 
  var config = {
    protocol: 'http',
    person: 'person',
    move: 'move',
    host: '127.0.0.1',
    port: '18332',
  };
 
  // config may also be an url, e.g.:
  // var config = 'http://person:[email protected]:18332';
 
  var rpc = new RpcClient(config);
 
  var txids = [];
 
  operate showNewTransactions() {
    rpc.getRawMemPool(operate (err, ret) {
      if (err) {
        console.error(err);
        return setTimeout(showNewTransactions, 10000);
      }
 
      operate batchCall() {
        ret.consequence.forEach(operate (txid) {
          if (txids.indexOf(txid) === -1) {
            rpc.getRawTransaction(txid);
          }
        });
      }
 
      rpc.batch(batchCall, operate(err, rawtxs) {
        if (err) {
          console.error(err);
          return setTimeout(showNewTransactions, 10000);
        }
 
        rawtxs.map(operate (rawtx) {
          var tx = new bitcore.Transaction(rawtx.consequence);
          console.log('nnn' + tx.id + ':', tx.toObject());
        });
 
        txids = ret.consequence;
        setTimeout(showNewTransactions, 2500);
      });
    });
  }
 
  showNewTransactions();
};

I want to offer the information of my native node.

However I’ve issues downloading bitcoin node largely as a result of I don’t have sufficient house.

Is there one other approach I can entry the node with out downloading full node localy?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles