Bitcoin Forum
May 07, 2024, 04:38:51 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help getting started with Mining and Pools  (Read 909 times)
Eli (OP)
Full Member
***
Offline Offline

Activity: 128
Merit: 100



View Profile
June 10, 2011, 11:40:52 AM
 #1

Hey all,
I've been lurking here for two weeks or so, and lately I started working on a project similar to http://bitp.it/, but I seem to miss some very basic ideas in bitcoin mining, and I would love some help if you could.

My idea is to create a simple PHP work distribution app, I am able to connect to bitcoind and poll some data from it, but I don't understand how do I offload data to other clients.

Like so:
Code:
<?

require_once 'jsonrpcphp/includes/jsonRPCClient.php';

$bitcoin = new jsonRPCClient('http://eli:isthemaster@127.0.0.1:8332/');
var_dump($bitcoin->getinfo());

?>

My understanding of bitcoin mining goes something like this:

  • Connect to bitcoin network
  • Get the latest target
  • Calculate some numbers and hash the result using SHA256 function
  • Compare my result with current target
  • If my result smaller or equal to target, I got the winning hash
  • Send something to bitcoin saying "I have found the somethig"
  • Network then verifies that I did found the correct something and rewards me with some bitcoins

From what I've gathered by reading and re-reading the wiki, this is the process that takes place when mining for bitcoins.

But the problem is that I completelly miss what it is that is being calculated and how it is being calculated.

From playing around with bitp.it I understand that what it basically does is sending "clients" a starting point and an end point, and those are simply calculating the data, and if their hash is correct, they reply with the correct hash back to bitp.it and I'm rewarded for the effort.

To my question:
Can you please show a very basic function that does the mining from start to finish? I prefer it to be in PHP, but I'll understand other languages (I hope).

Thanks a bunch!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!