I've been reading lots of articles, trying to understand how to hash the data returned from getwork; but I totally overlooked getblocktemplate.

I'm just trying to understand how all the data below is put together to generate hashes, in order to form a valid block (using various nonces).

Apologies if this has been answered already. I know there are lots of articles on how to put together a block header, and using midstate, etc. Most of that I understand; but the data composition of getblocktemplate is quite a bit different, and really threw me off.

If someone would be kind enough to explain the whole hashing process (from a mining point of view), I'd really appreciate it. A programmatic explanation would be ideal, as I'm trying to make my own mining client.


2 Answers 2


The wiki has an extremely good explanation, with a python run-through that takes you from GBT output to share submission. You could also have a look at some of the implementation in Luke-Jr's "gmp-proxy", which translates GBT reponses into a getwork compatible interface.



  • 1
    I read through that, but a lot of the terminology is new to me, and hard to understand. For example, it doesn't explain the parameters it's passing in, and their significance - {"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}. Also, on the return data - '"mutable":["time","transactions","prevblock"] vs "mutable": ["coinbase/append"]. On my GBT response, it has coinbaseaux flags instead of coinbasetxn data - what's the significance of that? What exactly does height mean? How is that all put together? It doesn't explain the smaller details.
    – xil3
    Sep 19, 2013 at 18:54
  • Thanks for posting the gmp-proxy - I'll take a look at that.
    – xil3
    Sep 19, 2013 at 19:05
  • Unfortunately, I'm not even that well versed in working with GBT. There's very little detail in any of the documentation, and it's actually quite unusual to have that much detail on an internal topic on the internal wiki. I'd suggest talking to one of the developers on freenode#bitcoin, maybe try and catch Luke-Jr if he is around. If anyone knows how GBT works, it's the person who developed it.
    – Anonymous
    Sep 21, 2013 at 5:34
  • Yeah, I just joined that channel, but everyone seems to be idle. Hopefully someone sees my plea for help.
    – xil3
    Sep 21, 2013 at 5:54
  • #bitcoin-dev would be the correct channel for this. Dec 17, 2013 at 1:32

You probably want to look at BIPs 22 and 23, as well as the libblkmaker source code (which includes an example of usage).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.