forked from slickage/baron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitcoinutil.js
More file actions
36 lines (29 loc) · 777 Bytes
/
bitcoinutil.js
File metadata and controls
36 lines (29 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var bitcore = require('bitcore');
var RpcClient = bitcore.RpcClient;
var config = require(__dirname + '/config');
var client = new RpcClient({
protocol: 'http',
host: config.bitcoind.host,
port: config.bitcoind.port,
user: config.bitcoind.user,
pass: config.bitcoind.pass
});
var getPaymentAddress = function(cb) {
client.getNewAddress(cb);
};
var getTransaction = function(txId, cb) {
client.getTransaction(txId, cb);
};
var getBlock = function(txId, cb) {
client.getBlock(txId, cb);
};
var listSinceBlock = function(blockHash, cb) {
client.listSinceBlock(blockHash, cb);
};
module.exports = {
bitcoinClient: client,
getPaymentAddress: getPaymentAddress,
getTransaction: getTransaction,
getBlock: getBlock,
listSinceBlock: listSinceBlock
};