Socket
Book a DemoInstallSign in
Socket

bitcoind-rpc-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcoind-rpc-client

Bitcoind RPC client

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

bitcoind-rpc-client

NPM Package build status Coverage Status Dependency status

js-standard-style

Bitcoind RPC client with blackjack and hookers.

Current rpc client support promises and callbacks.

Installation

npm install bitcoind-rpc-client

Commands

You can find list of all available commands in source code.

Examples

Create client

var client = new RpcClient({
  host: '127.0.0.1',
  port: 18332
});
client.set('user', 'bitcoinrpc')

getnewaddress with callback

client.getNewAddress(function (err, result) {
  console.log(err, result) // null, {result: {...}, error: null}
})

getnewaddress with promise

client.getNewAddress().then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

alias of getnewaddress with promise

client.getnewaddress().then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

getnewaddress using cmd

client.cmd('getnewaddress').then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

batch (array form)

client.batch([
  {method: 'getnewaddress', params: ['myaccount']},
  {method: 'getnewaddress', params: ['myaccount']}
])
.then(function (result) {
  console.log(result) // [{result: {...}, error: null}, {result: {...}, error: null}]
})

batch (chained form)

client.batch()
  .getInfo()
  .clear()
  .getNewAddress('myaccount')
  .getNewAddress('secondaccount')
  .call()
  .then(function (result) {
    console.log(result) // [{result: {...}, error: null}, {result: {...}, error: null}]
  })

License

Code released under the MIT license.

Keywords

bitcoin

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts