$cmd, 'params' => $params, 'id' => '1' )); // Prepare and performs the HTTP POST $opts = array ('http' => array ( 'method' => 'POST', 'header' => 'Content-type: application/json', 'content' => $request )); $fp = fopen($emcCONNECT, 'rb', false, stream_context_create($opts)); if(!$fp) throw new Exception('emcssl_NVS_req: Unable to connect to EMC-wallet'); $rc = json_decode(stream_get_contents($fp), true); $er = $rc['error']; if(!is_null($er)) throw new Exception('emcssl_NVS_req: Response error: ' . $er); return $rc['result']; } // emcssl_NVS //-------------------------------------------- $depth = array_key_exists('depth', $_GET)? $_GET['depth'] : 100; if($depth > 1000) $depth = 1000; $height = Req('getblockcount', array()); echo "

BlockCount=$height Depth=$depth

\n"; $vermas = array(); for($b_no = 0; $b_no < $depth; $b_no++) { $bh = Req('getblockhash', array($height - $b_no)); $blk = Req('getblock', array($bh)); $ver = $blk['version'] & 0xf; // echo "Block $b_no -> $bh -> $ver\n"; $vermas[$ver]++; } // for echo "\n"; while(list($ver, $cnt) = each($vermas)) { $prc = 100.0 * $cnt / $depth; echo "\n"; // echo "Version=$ver cnt=$cnt $prc\n"; } echo "
VersionCount%
$ver$cnt$prc
"; ?>