Author

Topic: Help getting started with Mining and Pools (Read 929 times)

Eli
full member
Activity: 128
Merit: 100
June 10, 2011, 06: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:[email protected]: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!
Jump to: