Title: what miners are trying to resolve? Post by: alikim on February 13, 2011, 02:57:18 AM Can anyone please point me to the info about what exactly needs to be solved to generate coins?
I'd like to see an example of a block, what the cryptographic problem is, and what the valid answer looks like Thanks! Title: Re: what miners are trying to resolve? Post by: theymos on February 13, 2011, 03:03:00 AM You hash the block header and try to get the hash below the current target.
https://en.bitcoin.it/wiki/Block https://en.bitcoin.it/wiki/Block_hashing_algorithm https://en.bitcoin.it/wiki/Target Title: Re: what miners are trying to resolve? Post by: LZ on February 13, 2011, 03:22:24 AM The block example (it is №107764 (http://blockexplorer.com/block/00000000000271de9d8b94afff543366e290e995f3e3e337bb86a0b7bf02e8d1)):
Code: { The hash of that block header: Code: 00000000000271de9d8b94afff543366e290e995f3e3e337bb86a0b7bf02e8d1 The current target: Code: 0000000000028552000000000000000000000000000000000000000000000000 The cryptoproblem is that the block header SHA-256 hash should be below the current target. Title: Re: what miners are trying to resolve? Post by: alikim on February 13, 2011, 03:49:35 AM Thanks!
Title: Re: what miners are trying to resolve? Post by: alikim on February 14, 2011, 09:28:02 AM after some thinking, I have a few more questions...
hope it's not very annoying :) 1. which part of the above code is actually "the block header"? 2. as I understand it, you need to add nonce to the block header and then calculate SHA256? Or you need to add nonce to the hash of the block header? 3. what is the nonce in the code: "nonce":329961997, is that the successful one for the previous block? 4. do I always have to start with nonce=0 and increment it, or I can start with any number? 5. when a job is sent to a miner worker, is it a certain range of nonces I need to calculate, or is it a part of the SHA256? Thanks! Title: Re: what miners are trying to resolve? Post by: redcodenl on February 14, 2011, 05:54:12 PM Good questions, I'm trying to answer those as well. Some things I've found out:
- The nonce is what a miner itself increases after every try. - I think you need to hash quite some fields, the nonce, timestamp, and more (merkle root?) - The generated hash needs to be smaller then the current target (which you can retrieve) I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do). Who can enlighten us? When you get a block, which steps do you need to do to generate a (possible) new block? Can somebody write it down in pseudo code? Title: Re: what miners are trying to resolve? Post by: jgarzik on February 14, 2011, 06:39:36 PM Good questions, I'm trying to answer those as well. Some things I've found out: - The nonce is what a miner itself increases after every try. - I think you need to hash quite some fields, the nonce, timestamp, and more (merkle root?) - The generated hash needs to be smaller then the current target (which you can retrieve) I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do). To mine, you really need to know the bitcoin data structures quite intimately... ultimately that means reading the bitcoind source code. Title: Re: what miners are trying to resolve? Post by: redcodenl on February 14, 2011, 09:36:00 PM I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do). To mine, you really need to know the bitcoin data structures quite intimately... ultimately that means reading the bitcoind source code. Not that I don't want to dive into the source code to find out, but it can't really be that hard to explain how a miner works can it? Most likely it just takes some data, hashes it with one or two changing variables and tests if it fits the current target? I doubt knowing the data structures intimately is really necessary, but I get the feeling it is more adviced and/or encouraged? Rather then having to read sources and decypher the algorithm I'd rather see it described somewhere. I know a little C/C++ so I'll probably be able to decypher the code. When/if I find the time I'll dive into the source code to find out how it works. If I do, I'll write a more elaborate description. |