flocore-node/docs/services/db.md
2015-09-15 12:56:44 -04:00

1.0 KiB

Database Service

An extensible interface to the bitcoin block chain. The service builds on the Bitcoin Service, and includes additional methods for working with the block chain.

API Documentation

Get Transaction

var txid = 'c349b124b820fe6e32136c30e99f6c4f115fce4d750838edf0c46d3cb4d7281e';
var includeMempool = true;
node.getTransaction(txid, includeMempool, function(err, transaction) {
  //...
});

Get Transaction with Block Info

var txid = 'c349b124b820fe6e32136c30e99f6c4f115fce4d750838edf0c46d3cb4d7281e';
var includeMempool = true;
node.getTransactionWithBlockInfo(txid, includeMempool, function(err, transaction) {
  //...
});

Get Block

var blockHash = '00000000d17332a156a807b25bc5a2e041d2c730628ceb77e75841056082a2c2';
node.getBlock(blockHash, function(err, block) {
  //...
});

Get Block Hashes by Timestamp Range

var time1 = 1441911000; // Notice time is in seconds not milliseconds
var time2 = 1441914000;

node.getBlockHashesByTimestamp(time1, time2, function(err, hashes) {
  //...
});