This package has been deprecated

Author message:

This project has been abandoned

@carnesen/bitcoin-rpc
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

@carnesen/bitcoin-rpc npm version Build Status

A Node.js client for bitcoin's remote procedure call (RPC) interface. This package includes runtime JavaScript files suitable for Node.js >=8 as well as the corresponding TypeScript type declarations.

Usage

const { createBitcoinRpc } = require('@carnesen/bitcoin-rpc');

const rpcuser = 'carnesen';
const rpcpassword = 'password';
const rpcHref = `http://${rpcuser}:${rpcpassword}@127.0.0.1:18443/`;
const bitcoinRpc = createBitcoinRpc(href);

bitcoinRpc('getblockhash', { height: 0 })
  .then(result => {
    // 0f9188f13cb7b2c71f2a335e3a4f
  })

API

createBitcoinRpc(href): bitcoinRpc

A factory function for creating bitcoin RPC clients

href

A string of the form http://<username>:<password>@<hostname>:<port>/ as defined by the WHATWG URL standard. The href can be passed to createBitcoinRpc to create an RPC client.

bitcoinRpc(method, params): Promise<result>

This section documents the function returned by createBitcoinRpc.

method

string. The name of an RPC method, e.g. getnetworkinfo.

params

Optional for some methods. An array of positional parameter values or an object of "named" parameter values for the specified method.

result

any. The remote procedure call's result.

Related

License

MIT © Chris Arnesen

Package Sidebar

Install

npm i @carnesen/bitcoin-rpc

Weekly Downloads

2

Version

0.0.0

License

MIT

Unpacked Size

26.7 kB

Total Files

43

Last publish

Collaborators

  • carnesen