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;
}
Example #2
0
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;
}
Example #3
0
// Install areyouahuman.com into this folder.
require_once "jsonRPCClient.php";
//get this here: http://jsonrpcphp.org/
$alt = new jsonRPCClient('http://*****:*****@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>';
    }
Example #4
0
    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"));
 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;
 }
Example #6
0
$dbusr = "******";
// 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 = "******";
    // username for bitcoin rpc
    $RPC_Pass = "******";
    // 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);
}
Example #7
0
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);
Example #8
0
 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.", "*****@*****.**");
 }
 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 {
}
# 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;
    }
}
Example #10
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/donate/jsonRPCClient.php";
$user = "******";
$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);
    }
}
Example #11
0
 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.", "*****@*****.**");
 }
 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);
Example #12
0
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;
}
 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');
 }
Example #14
0
 }
 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;
                             }
                         }
                     }
                 }
Example #15
0
<?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";
}
Example #16
0
<?php

if (isset($_GET['checkCons'])) {
    if (@(!mysql_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass'])) || @(!mysql_select_db($_POST['db_name']))) {
        header('Location: ./?step=3&db');
        exit;
    }
    include 'driver_test.php';
    $test = new jsonRPCClient('http://' . $_POST['w_user'] . ':' . $_POST['w_pass'] . '@' . $_POST['w_host'] . ':' . $_POST['w_port'] . '/');
    @($test_call = $test->getbalance());
    $included_ = true;
    include 'db_data.php';
    $db_file = fopen('../inc/db-conf.php', 'wb');
    fwrite($db_file, "<?php \n");
    fwrite($db_file, 'mysql_connect(\'' . $_POST['db_host'] . '\',\'' . $_POST['db_user'] . '\',\'' . $_POST['db_pass'] . '\');' . "\n");
    fwrite($db_file, 'mysql_select_db(\'' . $_POST['db_name'] . '\');' . "\n");
    fwrite($db_file, 'mysql_query("SET NAMES utf8");' . "\n");
    fwrite($db_file, "?>");
    fclose($db_file);
    $w_file = fopen('../inc/driver-conf.php', 'wb');
    fwrite($w_file, "<?php \n");
    fwrite($w_file, '$driver_login=\'http://' . $_POST['w_user'] . ':' . $_POST['w_pass'] . '@' . $_POST['w_host'] . ':' . $_POST['w_port'] . '/\';' . "\n");
    fwrite($w_file, "?>");
    fclose($w_file);
    header('Location: ./?step=4');
    exit;
}
if (isset($_GET['saveB'])) {
    include '../inc/db-conf.php';
    mysql_query("UPDATE `system` SET `title`='{$_POST['s_title']}',`url`='{$_POST['s_url']}',`currency`='{$_POST['s_cur']}',`currency_sign`='{$_POST['s_cur_sign']}',`description`='{$_POST['s_desc']}' WHERE `id`=1");
    header('Location: ./?step=5');
Example #17
0
 function getHouseBalance()
 {
     try {
         $bitcoind = new jsonRPCClient('http://' . $this->__get("username") . ':' . $this->__get("password") . '@' . $this->__get("btcserver") . ':' . $this->__get("btcport") . '/');
         $balance = $bitcoind->getbalance("bitsman");
         return $balance;
     } catch (Exception $e) {
         return 0;
     }
 }
Example #18
0
 if ($_SERVER['REMOTE_ADDR'] != $allow) {
     die;
 }
 $select_query = $db->prepare("SELECT *  FROM `cryptsy` WHERE `status` = '3'");
 $select_query->execute();
 if ($select_query->rowCount() > 0) {
     while ($row = $select_query->fetch()) {
         $select_coins = $db->prepare("SELECT SUM(coins) FROM `cryptsy_log` WHERE `sid` = :id AND `status` = '0'");
         $select_coins->bindParam(':id', $row['id'], PDO::PARAM_STR);
         $select_coins->execute();
         $max = $select_coins->fetch();
         $select_user = $db->prepare("SELECT * FROM `cryptsy_log` WHERE `sid` = :id AND `status` = '0'");
         $select_user->bindParam(':id', $row['id'], PDO::PARAM_STR);
         $select_user->execute();
         while ($row2 = $select_user->fetch()) {
             $i = $vertcoin->getbalance("*", 6);
             if ($max['SUM(coins)'] > $i) {
                 echo "{$max['SUM(coins)']} {$i}";
                 die('no');
             }
             $p_vtc = $row2['coins'] * 100 / $max['SUM(coins)'];
             $u_vtc = $row['vtc'] * $p_vtc / 100 - 0.001;
             // Получить address
             $select_address = $db->prepare("SELECT * FROM `address` WHERE `id` = :id");
             $select_address->bindParam(':id', $row2['uid'], PDO::PARAM_STR);
             $select_address->execute();
             $row3 = $select_address->fetch();
             echo "{$u_vtc} => {$row3['vtc']} <br/>";
             // отправить койн
             $stxid = $vertcoin->sendtoaddress($row3['vtc'], $u_vtc);
             // записать статус
Example #19
0
" height="100"></a><br><?php 
echo $faucetSubtitle;
?>
</h3>
      <fieldset>

        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->
        <a href="https://hashflare.io/r/69295B0A-ads"><img src="https://hashflare.io/banners/468x60-eng-2.jpg" alt="HashFlare"></a>
        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->

        <br>


          <?php 
$bitcoin = new jsonRPCClient('http://127.0.0.1:8070/json_rpc');
$balance = $bitcoin->getbalance();
$balanceDisponible = $balance['available_balance'];
$lockedBalance = $balance['locked_amount'];
$dividirEntre = 100000000;
$totalBCN = ($balanceDisponible + $lockedBalance) / $dividirEntre;
$recaptcha = new Recaptcha($keys);
//Available Balance
$balanceDisponibleFaucet = number_format(round($balanceDisponible / $dividirEntre, 8), 8, '.', '');
?>

        <form action="request.php" method="POST">

          <?php 
if (isset($_GET['msg'])) {
    $mensaje = $_GET['msg'];
    if ($mensaje == "captcha") {
}
# 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 Bitcoin Information Here
require_once '../bitcoin/jsonRPCClient.php';
$bitcoin = new jsonRPCClient($rpc);
if (!$bitcoin->getinfo()) {
    die('could not connect to bitcoind');
}
$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 = $bitcoin->getbalance($btcaccount);
    //print($received);
    if ($amount <= $received) {
        //echo 'PAID';
        $fee = 0;
        $transid = $bitcoin->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;
    }
}