Permalink
Browse files

proxy for bitp.it

  • Loading branch information...
1 parent ed2e422 commit 2e4e022b4844bca72f98a0a0af7f646a20a9057d @codler committed Jun 19, 2011
Showing with 23 additions and 3 deletions.
  1. +2 −0 README.md
  2. +1 −1 miner.php
  3. +18 −0 proxy.php
  4. +2 −2 work.php
View
@@ -5,6 +5,8 @@ phpMiner uses CPU and it is slower than normal CPU miner. I didn't know it until
Run test.php for testcase.
Look in work.php for example how to use.
+The proxy.php should have URI "/"
+
I am open for improvements and feedback.
## Donate
View
@@ -170,7 +170,7 @@ function run($keep_alive=60, $sleep=1, $nonces = 0xffffffff, $silence = false) {
$end_time = microtime(true);
- $this->hash_rate = ($nonce - $first_nonce) / ($end_time - $start_time);
+ $this->hash_rate = ($nonce - $first_nonce) / ($end_time - $start_time) * 1000;
$this->hash_count = $this->hash_rate * $check_interval;
View
@@ -0,0 +1,18 @@
+<?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"}';
+}
+?>
View
@@ -37,6 +37,6 @@
If you want to mine on bitp.it
*/
# Parameters: ClientID and Domain
-#$miner = new BitpitMiner(4384, 'zencodez.net');
-#$miner->run();
+$miner = new BitpitMiner(4384, 'zencodez.net');
+$miner->run();
?>

0 comments on commit 2e4e022

Please sign in to comment.