Skip to content

Commit

Permalink
add better way to compute total supply
Browse files Browse the repository at this point in the history
  • Loading branch information
lyoshenka committed Aug 25, 2016
1 parent 2059d4a commit d6c61c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.js
Expand Up @@ -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
/*
Expand All @@ -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'));
Expand Down
5 changes: 5 additions & 0 deletions lib/explorer.js
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions settings.json.template
Expand Up @@ -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
Expand Down

0 comments on commit d6c61c8

Please sign in to comment.