I receive these variables from the mining pool:

job_id, prevhash, coinb1, coinb2, merkle_branch version, nbits, ntime, clean_jobs.

What must I do with them?

Can you write step by step formulas how to solve that problem?

What must I respond to the pool?

  • Have you looked at the source code of e.g. cgminer to see how they do it? It might help a lot towards understanding how pools and their miners communicate. Commented Jun 23, 2016 at 8:59
  • i cann't find where it is. Can you show me this pleace?
    – Oleg D
    Commented Jun 23, 2016 at 19:00
  • i find solution, answer not need any more Question is closed
    – Oleg D
    Commented Oct 30, 2016 at 19:44

2 Answers 2


Are you aware of the stratum protocol definition? I found a description here: https://slushpool.com/help/#!/manual/stratum-protocol. As a prerequisite, you need to know how block hashes are computed. See https://en.bitcoin.it/wiki/Block_hashing_algorithm for the definition.

When you'd compute hashes for solo mining, only hashes that meet the current difficulty are valuable. In contrast, when pool mining, you will submit hashes to the pool which meet a significantly lower difficulty requirement, so the pool can see that you're actually working. The number of "shares" that you produce will determine the portion of the block reward allocated to you when the pool finds a block.

Note that I cannot provide code samples or more detailed explanation, as I've never coded a bitcoin miner. Since you want to write the mining software, it's your job to find out :-)

  • but i ask you "how block hashes are computed?".
    – Oleg D
    Commented Jun 25, 2016 at 17:52

I wrote an article a while ago Bitcoin mining the hard way that describes what to do with the values from a mining pool.

The quick summary is you join the coinb1 (red), extranonce1 (green), extranonce2 (yellow, generated by miner) and coinb2 (blue) together to form the coinbase transaction like:

Mining transaction

This is combined with the merkle_branch data from the pool to generate the Merkle hash for the whole block. Then you build a block header and iterate over all the nonce values in the header. When all nonces are used, increment extranonce2 and try again. If you succeed, you send a JSON message to the mining pool with your nonces.

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.