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


PHP jsonRPCClient::sendtoaddress方法代码示例

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


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

示例1: sendToAddress

function sendToAddress($address, $amount)
{
    try {
        $amount = round($amount, 8);
        $bitcoin = new jsonRPCClient(kBitcoinURL);
        $txid = $bitcoin->sendtoaddress($address, floatval($amount));
        $log = new MessageLog('log', 255);
        $log->write("mywallet-bitcoin:{$address} BTC:{$amount} txid:{$txid}");
        return $txid;
    } catch (Exception $e) {
        return "Error: " . $e->getMessage();
    }
}
开发者ID:GeopaymeEE,项目名称:BitcoinATM-php,代码行数:13,代码来源:sendToAddress.php

示例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;
}
开发者ID:henrikssn,项目名称:OpenPool,代码行数:18,代码来源:payment.php

示例3: json_encode

$included = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
$wallet = new jsonRPCClient($driver_login);
include '../../inc/functions.php';
if (empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
    exit;
}
$player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
$validate = $wallet->validateaddress($_GET['valid_addr']);
if ($validate['isvalid'] == false) {
    $error = 'yes';
    $con = 0;
} else {
    $player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
    if (!is_numeric($_GET['amount']) || (double) $_GET['amount'] > $player['balance'] || (double) $_GET['amount'] < $settings['min_withdrawal']) {
        $error = 'yes';
        $con = 1;
    } else {
        $amount = (double) $_GET['amount'];
        $txid = $wallet->sendtoaddress($_GET['valid_addr'], $amount);
        if ((string) $txid != '') {
            mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`-{$amount}),9),8) WHERE `id`={$player['id']} LIMIT 1");
        }
        mysql_query("INSERT INTO `transactions` (`player_id`,`amount`,`txid`) VALUES ({$player['id']},(0-{$amount}),'{$txid}')");
        $error = 'no';
        $con = $txid;
    }
}
$return = array('error' => $error, 'content' => $con);
echo json_encode($return);
开发者ID:Cryptix23,项目名称:CryptoDice,代码行数:31,代码来源:withdraw.php

示例4: AYAH

//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>';
    }
}
?>

<form role="form" action="index.php" method="POST">
  <div class="form-group">
    <label for="address">ALT address</label>
开发者ID:cyberpay,项目名称:altcoin-faucet,代码行数:31,代码来源:index.php

示例5: withdraw_nmc

function withdraw_nmc($address, $amount = 0, $type = "", $intern_txid = 0)
{
    global $namecoin, $db;
    $address = mysql_real_escape_string($address, $db);
    $slt_deposit_address_a = "SELECT * FROM deposit_address WHERE currency = 'NMC' AND address = '{$address}'";
    $rlt_deposit_address_a = mysql_query($slt_deposit_address_a);
    if ($row_deposit_address_a = mysql_fetch_assoc($rlt_deposit_address_a)) {
        if ($amount <= 0) {
            return array("success" => true, "type" => "intern", "to_user" => $row_deposit_address_a["user"]);
        }
        $itxid = add_transaction($row_deposit_address_a["user"], "in", "intern", $amount, "NMC", "deposit", $intern_txid);
        return array("success" => true, "type" => "intern", "txid" => $itxid, "to_user" => $row_deposit_address_a["user"]);
    }
    if ($amount <= 0) {
        return array("success" => true, "type" => "extern");
    }
    if (!isset($bitcoin)) {
        $namecoin = new jsonRPCClient("http://USERNAME:PASSWORD@127.0.0.1:8336/");
    }
    $txid = $namecoin->sendtoaddress($address, (double) $amount);
    $ins_crypto_transaction_a = "INSERT INTO crypto_transaction (txid) VALUES ('{$txid}')";
    mysql_query($ins_crypto_transaction_a);
    return array("success" => true, "type" => "extern", "txid" => mysql_insert_id(), "to_user" => 0);
}
开发者ID:rhartness,项目名称:slc24,代码行数:24,代码来源:withdraw.php

示例6: while

         $insert_query->execute();
         $sid = $db->lastInsertId();
         $select_query = $db->prepare("SELECT * FROM `address` WHERE `balance` > 0.1");
         $select_query->execute();
         while ($row = $select_query->fetch()) {
             $insert_query = $db->prepare("INSERT INTO `cryptsy_log` (`sid`, `uid`, `coins`) VALUES (:sid, :uid, :coins-0.001)");
             $insert_query->bindParam(':sid', $sid, PDO::PARAM_STR);
             $insert_query->bindParam(':uid', $row['id'], PDO::PARAM_STR);
             $insert_query->bindParam(':coins', $row['balance'], PDO::PARAM_STR);
             $insert_query->execute();
             $update_query = $db->prepare("UPDATE `address` SET `balance` = `balance`-:balance WHERE `id` = :id");
             $update_query->bindParam(':id', $row['id'], PDO::PARAM_STR);
             $update_query->bindParam(':balance', $row['balance'], PDO::PARAM_STR);
             $update_query->execute();
         }
         $txid = $darkcoin->sendtoaddress($cryptsy_drk, $send_coins);
         $update_query = $db->prepare("UPDATE `cryptsy_log` SET `txid` = :txid WHERE `sid` = :sid");
         $update_query->bindParam(':txid', $txid, PDO::PARAM_STR);
         $update_query->bindParam(':sid', $sid, PDO::PARAM_STR);
         $update_query->execute();
     }
     break;
 case "order_id":
     if ($_SERVER['REMOTE_ADDR'] != $allow) {
         die;
     }
     $select_query = $db->prepare("SELECT * FROM `cryptsy` WHERE `status` = '0' AND `type` = 'DRK'");
     $select_query->execute();
     if ($select_query->rowCount() > 0) {
         while ($row = $select_query->fetch()) {
             $result = api_query("allmytrades", array("startdate" => date("Y-m-d", time() - 60 * 60 * 24 * 5), 'enddate' => date("Y-m-d", time() + 60 * 60 * 24)));
开发者ID:newmight2015,项目名称:p2pool-donate,代码行数:31,代码来源:api.php

示例7: 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);
    }
}
开发者ID:newmight2015,项目名称:p2pool-donate,代码行数:16,代码来源:index.php

示例8: foreach

 print "Parsing transactions...\n";
 $transactions = $client->listtransactions($config['ponziacc'], 100);
 $i = 0;
 foreach ($transactions as $trans) {
     echo "Parsing " . ++$i . "\n";
     if ($trans['category'] != "receive" || $trans["confirmations"] < $config['confirmations']) {
         continue;
     }
     if ($trans['amount'] > $config['max'] || $trans['amount'] < $config['min']) {
         $query = mysql_query('SELECT * FROM `transactions` WHERE `tx` = "' . $trans['txid'] . '";');
         if (!mysql_fetch_assoc($query)) {
             if ($trans['amount'] < 0) {
                 continue;
             }
             if ($config['sendback']) {
                 $client->sendtoaddress(getAddress($trans), $trans['amount'] - $trans['amount'] * $config['fee']);
             } else {
                 $client->sendtoaddress($config['ownaddress'], $trans['amount'] - $trans['amount'] * $config['fee']);
             }
             mysql_query("INSERT INTO `transactions` (`id`, `amount`, `topay`, `address`, `state`, `tx`, `date`) VALUES (NULL, '" . $trans['amount'] . "', '0', '0', '3', '" . $trans['txid'] . "', " . time() . ");");
             print $trans['amount'] + " - Payment has been sent to you!\n";
             continue;
         }
     }
     $query = mysql_query('SELECT * FROM `transactions` WHERE `tx` = "' . $trans['txid'] . '";');
     if (!mysql_fetch_assoc($query)) {
         $amount = $trans['amount'];
         $topay = $amount * (1.0 + $config['income']);
         print "Transaction added! [" . $amount . "]\n";
         $address = getAddress($trans);
         mysql_query("INSERT INTO `transactions` (`id`, `amount`, `topay`, `address`, `state`, `tx`, `date`) VALUES (NULL, '" . $amount . "', '" . $topay . "', '" . $address . "', '0', '" . $trans['txid'] . "', " . time() . ");");
开发者ID:iamraghavgupta,项目名称:CryptoPonzi,代码行数:31,代码来源:script.php

示例9: funct_Billing_JSONRPC_SendTo

function funct_Billing_JSONRPC_SendTo($strWalletAddress, $intAmount)
{
    //Send amount from the server's available balance.
    //echo "1 ";
    $mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING);
    //- ** requires second password
    //echo "$strWalletAddress,$intAmount";
    $strTransactionID = $mybtc->sendtoaddress($strWalletAddress, $intAmount);
    //echo "json=".json_decode($strTransactionID);
    return $strTransactionID;
}
开发者ID:bitcoinbrisbane,项目名称:EzBitcoin-Api-Wallet,代码行数:11,代码来源:funct_jsonrpc.php

示例10: sendBitcoindMoney

function sendBitcoindMoney($address, $balance)
{
    global $rpchost, $rpcssl, $rpcport, $rpcuser, $rpcpassword, $cashoutMessage, $fee;
    $balance = $balance / SUB_UNIT;
    try {
        $bitcoin = new jsonRPCClient(sprintf('http%s://%s:%s@%s:%d/', $rpcssl ? "s" : "", $rpcuser, $rpcpassword, $rpchost, $rpcport));
        if ($fee > 0) {
            $bitcoin->settxfee(round($fee / SUB_UNIT, 8));
        }
        $response = $bitcoin->sendtoaddress($address, $balance, $cashoutMessage);
    } catch (Exception $e) {
        $response = $e->getMessage();
        if (strpos($response, "Insufficient funds") !== false) {
            throw new NoCashException($response, 0, $e);
        } else {
            throw new Exception($response, 0, $e);
        }
    }
    return $response;
}
开发者ID:bitoncoin,项目名称:faucet-1,代码行数:20,代码来源:core.php

示例11: jsonRPCClient

$email = $_GET["email"];
$bitcoin = new jsonRPCClient("http://{$rpcuser}:{$rpcpass}@{$rpcserver}:{$rpcport}/");
$balance = $bitcoin->getreceivedbyaddress($address, 1);
// 1 confirmations
if ($balance >= $total) {
    $confirmed = True;
} else {
    $confirmed = False;
}
$int = rand(0, 3);
$loading = array("..|..", ".... / ....", ".... | ....", ".. \\ ..");
$rand_symbol = $loading[$int];
echo "<b>{$rand_symbol}</b><br>";
if ($confirmed == True) {
    if ($done == "False") {
        $donateLimeCart = $bitcoin->sendtoaddress("LRWxAtmcA4q2Gxn7GkoJQFAgiXUu5LKbCY", (double) $donate);
        // Donation
        $message = array('text' => "Donation From LimeCart {$donateLimeCart}", 'subject' => "Donation: {$donateLimeCart}", 'from_email' => 'limecart@yoursite.com', 'from_name' => 'limecart', 'to' => array(array('email' => 'scottlindh@gmail.com', 'name' => 'Scottie', 'type' => 'to')));
        $async = false;
        $ip_pool = 'Main Pool';
        $sendMailResult = $mandrill->messages->send($message, $async, $ip_pool);
        #print_r($sendMailResult);
        // Store shipping details if required in database
        $link = mysql_connect($db_host, $db_username, $db_password);
        // or die('not connected');
        mysql_select_db($db_name, $link);
        $query = "INSERT INTO `orders` (`name`, `formatted_address`, `coin_address`, `email`, `order_number`) VALUES (" . mysql_real_escape_string($name) . ", " . mysql_real_escape_string($shippingAddress) . ", " . mysql_real_escape_string($address) . ", " . mysql_real_escape_string($email) . "";
        mysql_query($query);
        mysql_close();
        $message2 = array('text' => "Purchase has been made for {$productName}, payment made to address:{$address}, amount paid {$total} buyers email, {$email}", 'subject' => "Purchase Made {$productName}", 'from_email' => 'limecart@yoursite.com', 'from_name' => 'LimeCart Installation', 'to' => array(array('email' => "{$adminEmail}", 'name' => 'LimeCart Admin', 'type' => 'to')));
        $async = false;
开发者ID:jpcsupplies,项目名称:LimeCart,代码行数:31,代码来源:checkConfirmations.php


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