A client library to connect to Bitcoin Core and B3Coin RPC in JavaScript.
b3coind-rpc.js runs on node, and can be installed via npm:
npm install b3coind-rpc
var run = function() {
var bitcore = require('bitcore');
var RpcClient = require('b3coind-rpc');
var config = {
protocol: 'http',
user: 'user',
pass: 'pass',
host: '127.0.0.1',
port: '5647',
};
var rpc = new RpcClient(config);
var txids = [];
function showBlockCount(callback){
rpc.getBlockcount(function (err, ret) {
callback(err,ret);
});
}
showBlockCount(function(err,ret){
if(err){
console.log(err);
}else{
console.log(ret.result);
}
});
Code released under the MIT license.
Copyright 2013-2018 BitPay, Inc.