# bitcoind-rpc

> Bitcoin Client Library to connect to Bitcoin Core via RPC

Latest version **0.9.1** (published 2021-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install bitcoind-rpc
pnpm add bitcoind-rpc
yarn add bitcoind-rpc
bun add bitcoind-rpc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.1 |
| Published | 2021-10-15 |
| First published | 2015-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 175 |
| Author | Stephen Pair |
| Maintainers | gasteve, nitsujlangston, unusualbob |
| Keywords | bitcoin, rpc |

## Links

- npm: https://www.npmjs.com/package/bitcoind-rpc
- Repository: https://github.com/bitpay/bitcoind-rpc
- Issues: https://github.com/bitpay/bitcoind-rpc/issues
- npm.io page: https://npm.io/package/bitcoind-rpc

## Recent versions

- 0.9.1 (latest) — 2021-10-15
- 0.9.0 — 2021-09-22
- 0.8.1 — 2019-06-12
- 0.8.0 — 2019-05-09
- 0.7.2 — 2018-06-27
- 0.7.1 — 2018-01-15
- 0.7.0 — 2016-09-20
- 0.6.0 — 2016-05-27
- 0.5.0 — 2015-12-11
- 0.4.0 — 2015-12-03
- 0.3.1 — 2015-07-27
- 0.3.0 — 2015-07-21
- 0.2.1 — 2015-02-12
- 0.0.0 — 2015-01-16

## README

bitcoind-rpc.js
===============

[![NPM Package](https://img.shields.io/npm/v/bitcoind-rpc.svg?style=flat-square)](https://www.npmjs.org/package/bitcoind-rpc)
[![Build Status](https://img.shields.io/travis/bitpay/bitcoind-rpc.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcoind-rpc)
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcoind-rpc.svg?style=flat-square)](https://coveralls.io/r/bitpay/bitcoind-rpc?branch=master)

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

## Get Started

bitcoind-rpc.js runs on [node](http://nodejs.org/), and can be installed via [npm](https://npmjs.org/):

```bash
npm install bitcoind-rpc
```

## Examples

```javascript
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](https://github.com/bitpay/bitcore/blob/master/LICENSE).**

Copyright 2013-2018 BitPay, Inc.

---
_Source: https://npm.io/package/bitcoind-rpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
