本文整理汇总了PHP中jsonRPCClient::getbalance方法的典型用法代码示例。如果您正苦于以下问题:PHP jsonRPCClient::getbalance方法的具体用法?PHP jsonRPCClient::getbalance怎么用?PHP jsonRPCClient::getbalance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsonRPCClient
的用法示例。
在下文中一共展示了jsonRPCClient::getbalance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: funct_Billing_JSONRPC_GetBalance
function funct_Billing_JSONRPC_GetBalance($strWalletAddress, $intConfirmationsCountMin)
{
//give address and minimum confirmations it must have and get the balance of that address
$mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING);
if (!$strWalletAddress) {
$strWalletAddress = '*';
}
if (!$intConfirmationsCountMin) {
$intConfirmationsCountMin = 0;
}
$intBalance = $mybtc->getbalance($strWalletAddress, $intConfirmationsCountMin);
return $intBalance;
}
示例2: sendBtc
function sendBtc($id, $amount)
{
#Send btc from id to address
$bitcoin = new jsonRPCClient("http://{$bitcoin_user}:{$bitcoin_pass}@127.0.0.1:8332/");
if ($bitcoin->getbalance() < $amount) {
return -1;
}
if (!debit($id, $amount)) {
return -2;
}
$address = getAddress($id);
if ($address == -1) {
return -3;
}
$comment = getUsernameById($id);
$bitcoin->sendtoaddress($address, $amount, $comment);
return 0;
}
示例3: jsonRPCClient
// Install areyouahuman.com into this folder.
require_once "jsonRPCClient.php";
//get this here: http://jsonrpcphp.org/
$alt = new jsonRPCClient('http://username:password@localhost:port/');
//set to altcoind user/pass/port
$min = 1;
//set to minimum payout
$max = 5;
//set to max payout
$ayah = new AYAH();
if (array_key_exists('submit', $_POST)) {
$score = $ayah->scoreResult();
if ($score) {
$username = $_POST['address'];
if (!empty($_POST['address'])) {
if ($alt->getbalance() < 1) {
echo '<div class="alert alert-dismissable alert-danger"><button type="button" class="close" data-dismiss="alert">×</button><strong>Error:</strong> <a href="#" class="alert-link"></a>Not enough balance.</div>';
} else {
$check = $alt->validateaddress($username);
if ($check["isvalid"] == 1) {
$amount = rand($min, $max);
$alt->sendtoaddress($username, $amount);
echo '<div class="alert alert-dismissable alert-success"><button type="button" class="close" data-dismiss="alert">×</button><strong></strong> <a href="#" class="alert-link"></a>You got ';
echo $amount;
echo " ALT!</div>";
}
}
}
} else {
echo '<div class="alert alert-dismissable alert-danger"><button type="button" class="close" data-dismiss="alert">×</button><strong>Error:</strong> <a href="#" class="alert-link"></a>Human Verification Failed.</div>';
}
示例4: SUM
echo json_encode(array('error' => 'yes', 'data' => 'invalid_m'));
exit;
}
if (!isset($_GET['hl']) || !is_int((int) $_GET['hl']) || $_GET['hl'] != 0 && $_GET['hl'] != 1) {
// high / low
echo json_encode(array('error' => 'yes', 'data' => 'invalid_hl'));
exit;
}
$wager = (double) $_GET['w'];
if ($wager < 1.0E-8 && $wager != 0) {
echo json_encode(array('error' => 'yes', 'data' => 'too_small'));
exit;
}
$reservedBalance = mysql_fetch_array(mysql_query("SELECT SUM(`balance`) AS `sum` FROM `players`"));
$reservedWaitingBalance = mysql_fetch_array(mysql_query("SELECT SUM(`amount`) AS `sum` FROM `deposits`"));
$serverBalance = $wallet->getbalance();
$serverFreeBalance = $serverBalance - $reservedBalance['sum'] - $reservedWaitingBalance['sum'];
$jakynasobekminimalne = $settings['bankroll_maxbet_ratio'];
if ($wager * $jakynasobekminimalne > $serverFreeBalance) {
echo json_encode(array('error' => 'yes', 'data' => 'too_big_bet', 'under' => $serverFreeBalance / $jakynasobekminimalne));
exit;
}
$multiplier = round((double) $_GET['m'], 2);
$under_over = (int) $_GET['hl'];
$chance['under'] = floor(1 / ($multiplier / 100) * ((100 - $settings['house_edge']) / 100) * 100) / 100;
$chance['over'] = 100 - $chance['under'];
$result = round($player['server_seed'], 2);
$win_lose = $under_over == 0 && $result <= $chance['under'] || $under_over == 1 && $result >= $chance['over'] ? 1 : 0;
$profit = -$wager;
$wagermmultiplier = $wager * $multiplier;
$player_ = mysql_fetch_array(mysql_query("SELECT `balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
示例5: LTC_MinAndMaxWallets
private static function LTC_MinAndMaxWallets()
{
$wallets = WalletsLtc::getAllWallets();
if (empty($wallets)) {
return null;
}
$maxBalance = null;
$keyMax = null;
$minBalance = null;
$keyMin = null;
$litecoin = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ":" . LTC_RPC_PORT . '/');
foreach ($wallets as $key => $value) {
try {
$balance = $litecoin->getbalance($value['account']);
} catch (Exception $e) {
$balance = null;
}
if ($balance !== null) {
$wallets[$key]['current_balance'] = $balance;
if ($minBalance === null || $minBalance > $balance) {
$minBalance = $balance;
$keyMin = $key;
}
if ($maxBalance === null || $maxBalance < $balance) {
$maxBalance = $balance;
$keyMax = $key;
}
}
}
$result['min'] = $wallets[$keyMin];
$result['max'] = $wallets[$keyMax];
return $result;
}
示例6: die
$dbusr = "Your_Username";
// database username
$dbpwd = "Your_password";
// database password
$dbtbl = "Your_DB_Name";
// database name
// connect to the database
$db_handle = mysql_connect($dbhst, $dbusr, $dbpwd) or die("cannot connect");
$db_found = mysql_select_db($dbtbl) or die("cannot select DB");
$user_session = $_SESSION['user_session'];
// set session and check if logged in
if (!$user_session) {
$Logged_In = 2;
} else {
$Logged_In = 7;
$RPC_Host = "127.0.0.1";
// host for bitcoin rpc
$RPC_Port = "8333";
// port for bitcoin rpc
$RPC_User = "Your_Username";
// username for bitcoin rpc
$RPC_Pass = "Your_Password";
// password for bitcoin rpc
// dont change below here
$nu92u5p9u2np8uj5wr = "http://" . $RPC_User . ":" . $RPC_Pass . "@" . $RPC_Host . ":" . $RPC_Port . "/";
$Bytecoind = new jsonRPCClient($nu92u5p9u2np8uj5wr);
$wallet_id = "zelles(" . $user_session . ")";
$Bytecoind_Balance = $Bytecoind->getbalance($wallet_id, 6);
$Bytecoind_accountaddresses = $Bytecoind->getaddressesbyaccount($wallet_id);
$Bytecoind_List_Transactions = $Bytecoind->listtransactions($wallet_id, 10);
}
示例7: array
if ($gkey != $key) {
$data = array("error" => 1, "errormsg" => "Invalid Key", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
if (!isset($_GET['command'])) {
$data = array("error" => 2, "errormsg" => "Invalid Command", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
$command = $_GET['command'];
$command = mb_convert_encoding($command, 'UTF-8', 'UTF-8');
if ($command == "getBalance") {
$data = array("error" => 0, "errormsg" => "", "time" => time(), "command" => $command, "response" => $bitcoin->getbalance());
header('Content-Type: application/json');
echo json_encode($data);
} else {
if ($command = "sendFrom") {
if (!isset($_GET['qr'])) {
$data = array("error" => 3, "errormsg" => "Invalid Wallet Address", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
$qr = $_GET['qr'];
if (trim($qr) == "") {
$data = array("error" => 3, "errormsg" => "Invalid Wallet Address", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
示例8: die
if (!get_lock("global")) {
die("Too many queries. Please try again later.");
}
$balance = get_balance($_SESSION["user_id"], "NMC");
if (count($errors) == 0) {
$result = withdraw_nmc($address);
if ($result["type"] == "extern") {
$amountwithfee = floor(($amount + $staticfee) * 100000000) / 100000000;
} else {
$amountwithfee = floor($amount * 100000000) / 100000000;
}
if ($amountwithfee > floor($balance * 100000000) / 100000000) {
$errors[] = "You don't have that much.";
}
}
$server_balance = $namecoin->getbalance();
$server_balance = 100000000000;
if (count($errors) == 0 && $server_balance < $amountwithfee * 1.05 + 1) {
$errors[] = "There's currently not enough Namecoins on the Namecoin24 servers to fulfill your withdrawal request. Don't worry, a Namecoin24 admin has been informed and will resolve this for you. You will get an email as soon as the Namecoins are available. Sorry for the inconvenience, but remember that a big part of the amounts are stored in a seperate wallets for your own security.";
send_mail("Emergency! Namecoin balance exhausted ({$server_balance} left)!", "A user with the email address " . $_SESSION["user_email"] . " legitimately tried to withdraw {$amount} Namecoins. There are still {$server_balance} Namecoins on the server. The request was denied. Please resolve this and make sure to inform the user.", "admin@solidcoin24.com");
}
if (count($errors) == 0) {
echo "{$amount} Namecoins are being transferred to {$address}.<br />";
$result = withdraw_nmc($address);
if ($result["type"] == "extern") {
$itxid = add_transaction($_SESSION["user_id"], "out", "extern", $amountwithfee, "NMC", "withdrawal", 0, $staticfee);
$tx = withdraw_nmc($address, $amount, "", $itxid);
$udt_transaction_a = "UPDATE transaction SET info_id = '{$tx['txid']}' WHERE id = '{$itxid}'";
mysql_query($udt_transaction_a);
echo "<small>Transaction (extern): " . crypte_transaction($tx["txid"]) . "</small>";
} else {
示例9: jsonRPCClient
}
# Checks gateway module is active before accepting callback
# Gateway Specific Variables
$u = $GATEWAY['username'];
$p = $GATEWAY['password'];
$h = $GATEWAY['host'] . ':' . $GATEWAY['port'];
$rpc = 'http://' . $u . ':' . $p . '@' . $h;
# Build Litecoin Information Here
require_once '../litcoin/jsonRPCClient.php';
$litecoin = new jsonRPCClient($rpc);
if (!$litecoin->getinfo()) {
die('could not connect to litcoind');
}
$sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"';
$results = mysql_query($sql);
while ($result = mysql_fetch_array($results)) {
$amount = $result['total'];
$btcaccount = $result['userid'] . '-' . $result['id'];
$received = $litecoin->getbalance($btcaccount);
//print($received);
if ($amount <= $received) {
//echo 'PAID';
$fee = 0;
$transid = $litecoin->getaccountaddress($btcaccount . '-' . $result['id']);
//checkCbTransID($transid);
addInvoicePayment($result['id'], $transid, $received, $fee, $gatewaymodule);
logTransaction($GATEWAY["name"], array('address' => $transid, 'amount' => $received), "Successful");
} else {
//echo 'Still Owes: '.$amount;
}
}
示例10: jsonRPCClient
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/donate/jsonRPCClient.php";
$user = "xxx";
$passwd = "yyy";
$vertcoin = new jsonRPCClient("http://{$user}:{$passwd}@127.0.0.1:5888/");
$i = $vertcoin->getbalance("*", 120);
if ($i >= 10) {
$json = file_get_contents("http://rus.p2pool.pl:9171/patron_sendmany/{$i["balance"]}/0.01");
$obj = json_decode($json);
foreach ($obj as $name => $value) {
$txid = $vertcoin->sendtoaddress($name, $value - 0.001);
echo "{$name} => {$value} => {$txid} <br/>";
sleep(1);
}
}
示例11: die
if (!get_lock("global")) {
die("Too many queries. Please try again later.");
}
$balance = get_balance($_SESSION["user_id"], "BTC");
if (count($errors) == 0) {
$result = withdraw_btc($address);
if ($result["type"] == "extern") {
$amountwithfee = floor(($amount + $staticfee) * 100000000) / 100000000;
} else {
$amountwithfee = floor($amount * 100000000) / 100000000;
}
if ($amountwithfee > floor($balance * 100000000) / 100000000) {
$errors[] = "You don't have that much.";
}
}
$server_balance = $bitcoin->getbalance();
if (count($errors) == 0 && $server_balance < $amountwithfee * 1.05 + 1) {
$errors[] = "There's currently not enough Bitcoins on the Bitcoin24 servers to fulfill your withdrawal request. Don't worry, a Bitcoin24 admin has been informed and will resolve this for you. You will get an email as soon as the Bitcoins are available. Sorry for the inconvenience, but remember that a big part of the amounts are stored in a seperate wallets for your own security.";
send_mail("Emergency! Bitcoin balance exhausted ({$server_balance} left)!", "A user with the email address " . $_SESSION["user_email"] . " legitimately tried to withdraw {$amount} Bitcoins. There are still {$server_balance} Bitcoins on the server. The request was denied. Please resolve this and make sure to inform the user.", "admin@solidcoin24.com");
}
if (count($errors) == 0) {
echo "{$amount} Bitcoins are being transferred to {$address}.<br />";
$result = withdraw_btc($address);
if ($result["type"] == "extern") {
$itxid = add_transaction($_SESSION["user_id"], "out", "extern", $amountwithfee, "BTC", "withdrawal", 0, $staticfee);
$tx = withdraw_btc($address, $amount, "", $itxid);
$udt_transaction_a = "UPDATE transaction SET info_id = '{$tx['txid']}' WHERE id = '{$itxid}'";
mysql_query($udt_transaction_a);
echo "<small>Transaction (extern): " . crypte_transaction($tx["txid"]) . "</small>";
} else {
$itxid = add_transaction($_SESSION["user_id"], "out", "intern", $amountwithfee, "BTC", "withdrawal", 0);
示例12: getBitcoindBalance
function getBitcoindBalance()
{
global $rpchost, $rpcssl, $rpcport, $rpcuser, $rpcpassword;
$bitcoin = new jsonRPCClient(sprintf('http%s://%s:%s@%s:%d/', $rpcssl ? "s" : "", $rpcuser, $rpcpassword, $rpchost, $rpcport));
return $bitcoin->getbalance() * SUB_UNIT;
}
示例13: addNewBTCWallet
public static function addNewBTCWallet()
{
$account = Core::validate($_POST['ACCOUNT']);
$share = Core::validate($_POST['SHARE']);
// percent
if ($account == null || $share == null || !Core::isDouble($share)) {
print 'Incorrect input data';
exit;
}
$result = WalletsBtc::findBy(array('account' => $account));
if (!empty($result)) {
print 'This account already exists';
exit;
}
$bitcoin = new jsonRPCClient('http://' . BTC_RPC_USER . ':' . BTC_RPC_PASSWORD . '@' . BTC_RPC_HOST . ':' . BTC_RPC_PORT . '/');
try {
$balance = $bitcoin->getbalance($account);
} catch (Exception $e) {
print $e;
exit;
}
$wallet = new WalletsBtc();
$wallet->setAccount($account);
$wallet->setValue($balance);
$wallet->setShare($share / 100.0);
$wallet->insert();
header('Location: /admin/btc');
}
示例14: jsonRPCClient
}
if ($loaded === true || $blockchain == 'multi') {
if ($blockchain != 'multi') {
$bitcoind = new jsonRPCClient("http://" . $rpc_options[$blockchain]['username'] . ":" . $rpc_options[$blockchain]['password'] . "@" . $rpc_options[$blockchain]['host'] . ":" . $rpc_options[$blockchain]['port'] . "/");
$raw = false;
if ($debug && $bitcoind && $loaded) {
$raw = $bitcoind->getinfo();
}
}
if ($call == 'address') {
$obj = ["address" => false, "blockchain" => $blockchain, "hash" => "N/A", "tx_count" => 0, "received" => 0, "balance" => 0, "raw" => []];
if (isset($_GET['id']) && $_GET['id']) {
$address = $_GET['id'];
$obj['address'] = $address;
$account_name = 'XXX_' . $address;
$balance = $bitcoind->getbalance($account_name, 1, true);
$received = $bitcoind->getreceivedbyaccount($account_name, 1);
$address = $bitcoind->validateaddress($obj['address']);
$txs = $bitcoind->listtransactions($account_name, 100, 0, true);
foreach ($txs as $tx_key => $tx) {
$raw_tx = $bitcoind->getrawtransaction($tx['txid'], 1);
foreach ($raw_tx['vout'] as $output) {
if ($output['scriptPubKey']['addresses'][0] == $_GET['id']) {
$asm = explode(' ', $output['scriptPubKey']['asm']);
foreach ($asm as $op) {
if (substr($op, 0, 2) != 'OP') {
$obj['hash'] = $op;
}
}
}
}
示例15: jsonRPCClient
<?php
require_once 'jsonRPCClient.php';
$electrum = new jsonRPCClient('http://localhost:7777');
echo '<b>Wallet balance</b><br />' . "\n";
try {
$balance = $electrum->getbalance();
echo 'confirmed: <i>' . $balance['confirmed'] . '</i><br />' . "\n";
echo 'unconfirmed: <i>' . $balance['unconfirmed'] . '</i><br />' . "\n";
} catch (Exception $e) {
echo nl2br($e->getMessage()) . '<br />' . "\n";
}