0.9.1 • Published 4 years ago

bitcoind-rpc v0.9.1

Weekly downloads
869
License
MIT
Repository
github
Last release
4 years ago

bitcoind-rpc.js

NPM Package Build Status Coverage Status

A client library to connect to Bitcoin Core RPC in JavaScript.

Get Started

bitcoind-rpc.js runs on node, and can be installed via npm:

npm install bitcoind-rpc

Examples

var run = function() {
  var bitcore = require('bitcore');
  var RpcClient = require('bitcoind-rpc');

  var config = {
    protocol: 'http',
    user: 'user',
    pass: 'pass',
    host: '127.0.0.1',
    port: '18332',
  };

  // config can also be an url, e.g.:
  // var config = 'http://user:pass@127.0.0.1:18332';

  var rpc = new RpcClient(config);

  var txids = [];

  function showNewTransactions() {
    rpc.getRawMemPool(function (err, ret) {
      if (err) {
        console.error(err);
        return setTimeout(showNewTransactions, 10000);
      }

      function batchCall() {
        ret.result.forEach(function (txid) {
          if (txids.indexOf(txid) === -1) {
            rpc.getRawTransaction(txid);
          }
        });
      }

      rpc.batch(batchCall, function(err, rawtxs) {
        if (err) {
          console.error(err);
          return setTimeout(showNewTransactions, 10000);
        }

        rawtxs.map(function (rawtx) {
          var tx = new bitcore.Transaction(rawtx.result);
          console.log('\n\n\n' + tx.id + ':', tx.toObject());
        });

        txids = ret.result;
        setTimeout(showNewTransactions, 2500);
      });
    });
  }

  showNewTransactions();
};

License

Code released under the MIT license.

Copyright 2013-2018 BitPay, Inc.

@tyz-wallet/crypto-rpcbitpushtxoitxoh@bitexchange-ltd/bitexchange-server-7.5.0-beta.3bitcoin-computer-nodevivek-bitcoin-computer-libvivek-bitcoin-computer-nodevivek-bitcoin-computer-node-testingvivek-computer-lib-testingvivek-computer-node-testingviek-bitcoin-computer-lib-teseting@vivek-singh/bitcoin-computer-lib-teseting@vivek-singh/bitcoin-computer-lib-testing@vivek-singh/bitcoin-computer-node-testing@vivek-singh/lib@vivek-singh/lib-testing@vivek-singh/node@vivek-singh/node-testing@everything-registry/sub-chunk-1239xbitworkhummingbird-bitcoinmagirpcmachinecore-nodelamassu-bitcoind@ts-core/blockchain@ts-core/btc@tokel/bitgo-komodo-cc-lib@tokel/nspv-js@upincome/c0bancore-node@zalastax/nolb-bitcfountainhead-bitdfountainhead-corefountainhead-core-optfountainhead-tnadvt-bitddvt-bitdb-coredvt-tnaeboost-bitcore-nodeeonacore-crypto-rpcfcash-nodeflocore-nodecoin-clusteringcrypto-rpcblockchain-to-sqliteblockcast-state-enginebitcore-node-hushbitcore-node-jincashbitcore-node-sumcoinbitcore-node-wyvernbitcore-node-zcashbitcore-node-komodobitcore-node-resbitcore-node-resistancebitpipebitcoind-coinbase-testbquestbpubpu-tsbtonbtcl-bitcore-nodebitcore-node-anonbitcore-node-cashbitcore-node-cprbitcore-node-dash-testbitcore-node-divibitcore-node-exccbitcoin-clibitcoin-rpc-promise-retrybitcoin-transaction-indexerbitservebitdbitex-nodebitworkbitxchange-serverdogecore-nodelitecore-node-rjmacarthytxotxo-strtxiotxhotnazcash-bitcore-nodexxtxoxxbitworkmonacore-noderoulette-apirpc-common-blockchainrawcore-nodesdd-bitcore-nodepoliscore-nodegnss@swtrse/crypto-rpc@piggydoughnut/bitgo-komodo-cc-lib@bitcoin-computer/lib@bitcoin-computer/node@blitzbank/dashboard@bitexchange-ltd/bitxchange-server@bitexchange-ltd/lamassu-server-beta@captemulation/bitcore-node
0.9.1

4 years ago

0.9.0

5 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.1

11 years ago

0.3.0

11 years ago

0.2.1

11 years ago

0.0.0

11 years ago