node-bitcoin-rpc

1.1.3 • Public • Published

Circle CI Coverage Status

node-bitcoin-rpc

nodejs json-rpc for bitcoin

Instructions:

  1. require() it
  2. call .init() with host, port, username, password as args
  3. call .call() with the method, param and callback (the callback takes (err, result))
  • optional: call .setTimeout() with the number of milliseconds to wait if 500 isn't enough

Example:

var bitcoin_rpc = require('node-bitcoin-rpc')

bitcoin_rpc.init('host', port, 'rpc_username', rpc_pass)
bitcoin_rpc.call('getbalance', [], function (err, res) {
  if (err !== null) {
    console.log('I have an error :( ' + err + ' ' + res.error)
  } else {
    console.log('Yay! I need to do whatevere now with ' + res.result)
  }
})

Defaults:

  • host; localhost
  • port: 8332
  • rpc_username: bitcoinrpc
  • rpc_password: foo
  • connection timeout: 500 ms

Readme

Keywords

Package Sidebar

Install

npm i node-bitcoin-rpc

Weekly Downloads

34

Version

1.1.3

License

MIT

Last publish

Collaborators

  • drazisil