Permalink
Browse files

add better way to compute total supply

  • Loading branch information...
lyoshenka committed Aug 24, 2016
1 parent 2059d4a commit d6c61c88ffe23e32f203bb91819edc6dec139a2d
Showing with 8 additions and 2 deletions.
  1. +2 −2 app.js
  2. +5 −0 lib/explorer.js
  3. +1 −0 settings.json.template
View
4 app.js
@@ -18,7 +18,7 @@ var app = express();
bitcoinapi.setWalletDetails(settings.wallet);
if (settings.heavy != true) {
bitcoinapi.setAccess('only', ['getinfo', 'getnetworkhashps', 'getmininginfo','getdifficulty', 'getconnectioncount',
- 'getblockcount', 'getblockhash', 'getblock', 'getrawtransaction', 'getpeerinfo']);
+ 'getblockcount', 'getblockhash', 'getblock', 'getrawtransaction', 'getpeerinfo', 'gettxoutsetinfo']);
} else {
// enable additional heavy api calls
/*
@@ -35,7 +35,7 @@ if (settings.heavy != true) {
bitcoinapi.setAccess('only', ['getinfo', 'getstakinginfo', 'getnetworkhashps', 'getdifficulty', 'getconnectioncount',
'getblockcount', 'getblockhash', 'getblock', 'getrawtransaction','getmaxmoney', 'getvote',
'getmaxvote', 'getphase', 'getreward', 'getnextrewardestimate', 'getnextrewardwhenstr',
- 'getnextrewardwhensec', 'getsupply']);
+ 'getnextrewardwhensec', 'getsupply', 'gettxoutsetinfo']);
}
// view engine setup
app.set('views', path.join(__dirname, 'views'));
View
@@ -234,6 +234,11 @@ module.exports = {
module.exports.balance_supply(function(supply) {
return cb(supply/100000000);
});
+ } else if (settings.supply == 'TXOUTSET') {
+ var uri = base_url + 'gettxoutsetinfo';
+ request({uri: uri, json: true}, function (error, response, body) {
+ return cb(body.total_amount);
+ });
} else {
coinbase_supply(function(supply) {
return cb(supply/100000000);
View
@@ -137,6 +137,7 @@
// GETINFO : retreive from getinfo api call (PoS)
// HEAVY: retreive from heavys getsupply api call
// BALANCES : total of all address balances
+ // TXOUTSET : retreive from gettxoutsetinfo api call
"supply": "COINBASE",
// how to acquire network hashrate

0 comments on commit d6c61c8

Please sign in to comment.