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

<p>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.</p>

<p>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 :-)</p>

CC BY-SA 3.0
2016-06-25T17:52:44.540Z
but i ask you "how block hashes are computed?".
Oleg D
CC BY-SA 3.0
2016-06-23T19:45:54.980Z
2016-06-23T19:45:54.980Z
Hans-Martin Mosner
<p>I wrote an article a while ago <a href="http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html" rel="nofollow noreferrer">Bitcoin mining the hard way</a> that describes what to do with the values from a mining pool.</p>

<p>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:</p>

<p><a href="https://i.sstatic.net/kb7zu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kb7zu.png" alt="Mining transaction"></a></p>

<p>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.</p>

CC BY-SA 3.0
2016-12-30T05:12:01.000Z
2016-12-30T05:12:01.000Z
Ken Shirriff
<p>I receive these variables from the mining pool:</p>

<p><code>job_id</code>, <code>prevhash</code>, <code>coinb1</code>, <code>coinb2</code>, <code>merkle_branch version</code>, <code>nbits</code>, <code>ntime</code>, <code>clean_jobs</code>.</p>

<p>What must I do with them? </p>

<p>Can you write step by step formulas how to solve that problem?</p>

<p>What must I respond to the pool?</p>

CC BY-SA 3.0
2016-06-23T08:59:56.207Z
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.
Hans-Martin Mosner
CC BY-SA 3.0
2016-06-23T19:00:29.743Z
i cann't find where it is. Can you show me this pleace?
Oleg D
CC BY-SA 3.0
2016-10-30T19:44:27.397Z
i find solution, answer not need any more Question is closed
Oleg D
<mining-pools><development><mining-hardware><mining-theory><algorithms>
Own bitcoin pool miner algorithm
Oleg D
# Own bitcoin pool miner algorithm

(Asked by: username_0 on 2016-06-22)

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?

**Tags:** mining-pools, development, mining-hardware, mining-theory, algorithms

> **Comments:**
> **username_1**: 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.  
> **username_0**: i cann't find where it is. Can you show me this pleace?  
> **username_0**: i find solution, answer not need any more Question is closed  

---

## 2 answers

### Answer by username_1 on 2016-06-23. Score: 1

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 :-)

> **Comments:**
> **username_0**: but i ask you "how block hashes are computed?".  

---

### Answer by username_2 on 2016-12-30. Score: 0

I wrote an article a while ago [Bitcoin mining the hard way](http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html) 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](https://i.sstatic.net/kb7zu.png)](https://i.sstatic.net/kb7zu.png)

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.


---

