当前位置: 首页>>代码示例>>PHP>>正文


PHP jsonRPCClient::getblockcount方法代码示例

本文整理汇总了PHP中jsonRPCClient::getblockcount方法的典型用法代码示例。如果您正苦于以下问题:PHP jsonRPCClient::getblockcount方法的具体用法?PHP jsonRPCClient::getblockcount怎么用?PHP jsonRPCClient::getblockcount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jsonRPCClient的用法示例。


在下文中一共展示了jsonRPCClient::getblockcount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: jsonRPCClient

if ($debug == True) {
    echo "[DEBUG TURNED ON, SHOWING ERRORS!]";
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(-1);
} else {
}
//END DEBUG
session_start();
include "polApi.php";
include_once "config.php";
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient("http://{$rpcuser}:{$rpcpass}@{$rpcserver}:{$rpcport}/");
//print_r($bitcoin->getinfo());
//echo "\n";
$blockcount = $bitcoin->getblockcount();
$daemonConnections = $bitcoin->getconnectioncount();
$daemonBlockCount = $bitcoin->getblockcount();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LimeCart v0.1</title>
<?php 
echo "<link href=\"style/{$styleSheet}\" rel=\"stylesheet\" type=\"text/css\">";
?>
</head>

<body>
开发者ID:jpcsupplies,项目名称:LimeCart,代码行数:30,代码来源:index.php

示例2: jsonRPCClient

<?php

require_once 'jsonRPCClient.php';
$data = new jsonRPCClient('http://user:pass@127.0.0.1:8332');
if ($rpctry) {
    try {
        $data->getblockcount();
    } catch (Exception $e) {
        echo "Sorry!  Bitcoin server is down.";
        exit;
    }
}
开发者ID:jasonkhanlar,项目名称:phpbitcoinscripts,代码行数:12,代码来源:rpcdefault.php

示例3: mysqli

// rpcport, rpcallowip and txindex=1 in your protoshares.conf
$rpchost = 'localhost';
$rpcuser = 'protosharesrpc';
$rpcpass = 'superdupersecretphrase';
$rpcport = '3838';
////////////////////////////////////////////////////////////////////////////////
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $database);
if ($mysqli->connect_errno) {
    throw new Exception("database connection error");
}
$r = $mysqli->query("select max(block_num) from outputs", MYSQLI_USE_RESULT);
$w = $r->fetch_assoc();
$last_block_in_db = $w["max(block_num)"] + 0;
$r->close();
$pts = new jsonRPCClient("http://" . $rpcuser . ":" . $rpcpass . "@" . $rpchost . ":" . $rpcport);
$blocknum = $pts->getblockcount();
if ($last_block_in_db < $blocknum) {
    for ($i = $last_block_in_db + 1; $i <= $blocknum; $i++) {
        echo "block " . $i . "\n";
        $block = $pts->getblock($pts->getblockhash($i));
        foreach ($block["tx"] as $txid) {
            $tx = $pts->decoderawtransaction($pts->getrawtransaction($txid));
            foreach ($tx["vin"] as $tx_in) {
                if (!array_key_exists("coinbase", $tx_in)) {
                    $mysqli->query("delete from outputs where transaction_hash='" . $tx_in["txid"] . "' and sequence=" . $tx_in["vout"] . ";");
                }
            }
            foreach ($tx["vout"] as $tx_out) {
                $scripttype = $tx_out["scriptPubKey"]["type"];
                switch ($scripttype) {
                    case "pubkeyhash":
开发者ID:amtjre,项目名称:pts-unspent,代码行数:31,代码来源:update-database.php

示例4: die

<?php

error_reporting(E_ALL);
include_once '/var/www/swork/dice/pr/inc/conf.php';
mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error() . " " . mysql_errno());
mysql_select_db(DATABASE) or die(mysql_error() . " " . mysql_errno());
//include json_rpc client
include_once JSON_RPC_CLIENT;
//connect to the wallet
$ftc = new jsonRPCClient('http://' . RPC_USER . ':' . RPC_PASS . '@' . RPC_HOST . ':' . RPC_PORT . '/');
$blockcount = $ftc->getblockcount();
while (true) {
    sleep(5);
    $txx = array();
    //scan last x=50 blocks for incomming but not processes transaction
    $transactions = $ftc->listsinceblock($ftc->getblockhash($blockcount - 50));
    if (is_array($transactions["transactions"]) && sizeof($transactions["transactions"]) > 0) {
        foreach ($transactions["transactions"] as $t) {
            if (array_key_exists($t["address"], $game_addresses) && $t["category"] == "receive") {
                //prevent transaction malleability
                $rawtx = $ftc->getrawtransaction($t["txid"], 1);
                $tprocessed = "";
                if (is_array($rawtx)) {
                    foreach ($rawtx["vin"] as $tinput) {
                        $tprocessed .= $tinput["txid"] . $tinput["vout"];
                    }
                } else {
                    die("grrr");
                }
                $tprocessed = md5($tprocessed);
                //end prevent transaction malleability
开发者ID:newmight2015,项目名称:dicestart,代码行数:31,代码来源:go.php

示例5: getBlockCount

 /**
  * @return Array - JSON RPC ARRAY
  */
 private static function getBlockCount()
 {
     $wallet = new jsonRPCClient(HOTWALLET, true);
     $return = $wallet->getblockcount();
     return $return;
 }
开发者ID:newmight2015,项目名称:BlockExplorer,代码行数:9,代码来源:run.php


注:本文中的jsonRPCClient::getblockcount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。