Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fanatid/bitcoind-rpc-client
Connect to Bitcoin Core via JSON-RPC in JavaScript.
https://github.com/fanatid/bitcoind-rpc-client
Last synced: 21 days ago
JSON representation
Connect to Bitcoin Core via JSON-RPC in JavaScript.
- Host: GitHub
- URL: https://github.com/fanatid/bitcoind-rpc-client
- Owner: fanatid
- License: mit
- Created: 2015-08-22T14:39:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-24T06:50:40.000Z (about 9 years ago)
- Last Synced: 2024-04-16T18:25:01.857Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cryptocoinjs - bitcoin
README
# bitcoind-rpc-client
[![NPM Package](https://img.shields.io/npm/v/bitcoind-rpc-client.svg?style=flat-square)](https://www.npmjs.org/package/bitcoind-rpc-client)
[![build status](https://img.shields.io/travis/fanatid/bitcoind-rpc-client.svg?branch=master&style=flat-square)](http://travis-ci.org/fanatid/bitcoind-rpc-client)
[![Coverage Status](https://img.shields.io/coveralls/fanatid/bitcoind-rpc-client.svg?style=flat-square)](https://coveralls.io/r/fanatid/bitcoind-rpc-client)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![Dependency status](https://img.shields.io/david/fanatid/bitcoind-rpc-client.svg?style=flat-square)](https://david-dm.org/fanatid/bitcoind-rpc-client#info=dependencies)Bitcoind RPC client with blackjack and hookers.
Current rpc client support promises and callbacks.
## Installation
```bash
npm install bitcoind-rpc-client
```## Commands
You can find list of all available commands in [source code](blob/master/src/methods.js).
## Examples
### Create client
```js
var client = new RpcClient({
host: '127.0.0.1',
port: 18332
});
client.set('user', 'bitcoinrpc')
```### getnewaddress with callback
```js
client.getNewAddress(function (err, result) {
console.log(err, result) // null, {result: {...}, error: null}
})
```### getnewaddress with promise
```js
client.getNewAddress().then(function (result) {
console.log(result) // {result: {...}, error: null}
})
```### alias of getnewaddress with promise
```js
client.getnewaddress().then(function (result) {
console.log(result) // {result: {...}, error: null}
})
```### getnewaddress using `cmd`
```js
client.cmd('getnewaddress').then(function (result) {
console.log(result) // {result: {...}, error: null}
})
```### batch (array form)
```js
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)
```js
client.batch()
.getInfo()
.clear()
.getNewAddress('myaccount')
.getNewAddress('secondaccount')
.call()
.then(function (result) {
console.log(result) // [{result: {...}, error: null}, {result: {...}, error: null}]
})
```## License
This software is licensed under the MIT License.