예제 #1
0
<?php

/**
 * @author Han Lin Yap < http://zencodez.net/ >
 * @copyright 2011 zencodez.net
 * @license http://creativecommons.org/licenses/by-sa/3.0/
 * @package Miner
 * @version 1.0 - 2011-06-18
 *
 * Feel free to donate: 1NibBDZPvJCm568CZMnJUBJoPyUhW7aSag
 */
require_once dirname(__FILE__) . '/miner.php';
set_time_limit(0);
// Example
$host = 'pit.deepbit.net';
$port = 8332;
$user = '******';
$pass = '******';
$miner = new Miner($host, $port, $user, $pass);
# Param1: How many seconds it should run
# Param2: How long it should sleep after each getwork
# Param3: How many nonce it should try before taking next getwork
$miner->run();
/*
------------------------------
If you want to mine on bitp.it
*/
# Parameters: ClientID and Domain
$miner = new BitpitMiner(4384, 'zencodez.net');
$miner->run();
예제 #2
0
<?php

require_once dirname(__FILE__) . '/miner.php';
header('Content-Type: application/json; charset=utf-8');
$raw = file_get_contents("php://input");
$data = json_decode($raw, false);
$miner = new BitpitMiner(4384, 'zencodez.net');
if (count($data->params) == 0) {
    $work = $miner->getwork();
    $data = json_decode($work, false);
    echo json_encode(array('result' => $data, 'error' => null, 'id' => 'json'));
} else {
    $result = $miner->getwork($data->params[0]);
    echo json_encode(array('result' => true, 'error' => null, 'id' => 'json'));
    #echo '{"result":true,"error":null,"id":"json"}';
}