function spectra_block_top() { $hash = getbestblockhash(); $block = getblock($hash); return $block; }
spectra_api_response($requested); } } if ($_REQUEST["method"] == "getblockhash") { if (!isset($_REQUEST["height"])) { spectra_api_response("", 0, "Block Height (&height=xxxxx) Is Required For Method 'getblockhash'"); } $requested = getblockhash((int) $_REQUEST["height"]); if (isset($requested["error"]) && $requested["error"] != "") { spectra_api_response("", 0, $requested["error"]["message"]); } else { spectra_api_response($requested); } } if ($_REQUEST["method"] == "getbestblockhash") { $requested = getbestblockhash(); if (isset($requested["error"]) && $requested["error"] != "") { spectra_api_response("", 0, $requested["error"]["message"]); } else { spectra_api_response($requested); } } if ($_REQUEST["method"] == "getblock") { if (!isset($_REQUEST["hash"])) { spectra_api_response("", 0, "Block Height (&hash=xxxxx) Is Required For Method 'getblock'"); } $requested = getblock($_REQUEST["hash"]); if (isset($requested["error"]) && $requested["error"] != "") { spectra_api_response("", 0, $requested["error"]["message"]); } else { spectra_api_response($requested);