function spectra_ledger_statistics() { echo "\t\t<h1> " . $GLOBALS["currency"]["name"] . " Distribution </h1> \n\n"; echo "\t\t<div class=\"ledger_panel\"> \n\n"; echo "\t\t\t<div class=\"ledger_detail\">\n"; echo "\t\t\t\t<div class=\"ledger_detail_label\"> \n"; echo "\t\t\t\t\tMoney Supply: \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t\t<div class=\"ledger_detail_value\"> \n"; echo "\t\t\t\t\t" . spectra_money_supply() . "\n"; echo "\t\t\t\t\t<br>\n"; echo "\t\t\t\t\t \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t</div> \n\n"; echo "\t\t\t<div class=\"ledger_detail\">\n"; echo "\t\t\t\t<div class=\"ledger_detail_label\"> \n"; echo "\t\t\t\t\tAddress Count: \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t\t<div class=\"ledger_detail_value\"> \n"; echo "\t\t\t\t\t" . spectra_address_count() . "\n"; echo "\t\t\t\t\t<br>\n"; echo "\t\t\t\t\t \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t</div> \n\n"; $top10 = spectra_money_top10(); echo "\t\t\t<div class=\"ledger_detail\">\n"; echo "\t\t\t\t<div class=\"ledger_detail_label\"> \n"; echo "\t\t\t\t\tTop 10: \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t\t<div class=\"ledger_detail_value\"> \n"; echo "\t\t\t\t\t" . $top10["total"] . "\n"; echo "\t\t\t\t\t<br>\n"; echo "\t\t\t\t\t" . $top10["percent"] . " %\n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t</div> \n\n"; $top100 = spectra_money_top100(); echo "\t\t\t<div class=\"ledger_detail\">\n"; echo "\t\t\t\t<div class=\"ledger_detail_label\"> \n"; echo "\t\t\t\t\t11 - 100: \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t\t<div class=\"ledger_detail_value\"> \n"; echo "\t\t\t\t\t" . $top100["total"] . "\n"; echo "\t\t\t\t\t<br>\n"; echo "\t\t\t\t\t" . $top100["percent"] . " %\n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t</div> \n\n"; $top1000 = spectra_money_top1000(); echo "\t\t\t<div class=\"ledger_detail\">\n"; echo "\t\t\t\t<div class=\"ledger_detail_label\"> \n"; echo "\t\t\t\t\t101 - 1000: \n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t\t<div class=\"ledger_detail_value\"> \n"; echo "\t\t\t\t\t" . $top1000["total"] . "\n"; echo "\t\t\t\t\t<br>\n"; echo "\t\t\t\t\t" . $top1000["percent"] . " %\n"; echo "\t\t\t\t</div> \n"; echo "\t\t\t</div> \n\n"; echo "\t\t</div> \n\n"; }
function spectra_money_top1000() { if (system_flag_get("balance_rebuild") > 0) { $balance_calc["total"] = "Re-Balancing"; $balance_calc["percent"] = "0.00"; return $balance_calc; } $accounts = mysqli_getset($GLOBALS["tables"]["ledger"], "1 ORDER BY `balance` DESC LIMIT 1000 OFFSET 100"); if ($accounts["success"] < 1 || $accounts["data"] == "") { $balance_calc["total"] = "Unavailable"; $balance_calc["percent"] = "0.00"; return $balance_calc; } // Initialize Calculation Result $sum_balances = 0; foreach ($accounts["data"] as $account) { $sum_balances = bcadd($sum_balances, $account["balance"], 8); } $calc_perc = bcdiv($sum_balances, spectra_money_supply(), 8); $balance_calc["total"] = $sum_balances; $balance_calc["percent"] = $calc_perc * 100; return $balance_calc; }
spectra_api_response("Address Exists"); } else { spectra_api_response("", 0, "Address Not Found"); } } if ($_REQUEST["method"] == "getbalance") { if (!isset($_REQUEST["address"])) { spectra_api_response("", 0, "Address (?address=xxxxx) Is Required For Method 'getbalance'"); } spectra_api_response(spectra_address_balance($_REQUEST["address"])); } if ($_REQUEST["method"] == "verifymessage") { spectra_api_response(verifymessage($_GET["address"], $_GET["signature"], urldecode($_GET["message"]))); } if ($_REQUEST["method"] == "moneysupply") { spectra_api_response(spectra_money_supply()); } /****************************************************************************** Explorer API ******************************************************************************/ if ($_REQUEST["method"] == "false") { // } /****************************************************************************** Final Error trap ******************************************************************************/ spectra_api_response("", 0, "Invalid or Unrecognized Request"); /****************************************************************************** Developed By Jake Paysnoe - Copyright © 2015 SPEC Development Team SPEC Block Explorer is released under the MIT Software License. For additional details please read license.txt in this package.