Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 1.12 KB

README.md

File metadata and controls

34 lines (29 loc) · 1.12 KB

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