<p>From <a href="https://bitcoin.stackexchange.com/q/11139/13866">How is the network hash rate calculated?</a> we can see that we can calculate the applied hashrate of an entity from the network difficulty and the number of blocks produced in a specific period (e.g. in a day). The entity in the linked question is the whole bitcoin network but the method can be applied to a single node. The entity cannot fake this hashrate because they have to present sufficient blocks with hashes less than the required target.</p>
<p>In any reasonable measurement period (e.g. a day), a typical pool member will not produce any hashes at the current Bitcoin network target. But if the pool asks the members to present blocks with hashes less than an easier target, every period the member will be able to produce many blocks meeting that easier target. The pool operator can therefore measure contributed hashrate. As you pointed out, the pool operator has to check that hashes are not repeated. To prevent collusion each pool member would need to include a unique marker in their template so that the pool operator can check.</p>
<p>Note that the <em>method</em> used by the pool member to mine blocks is completely independent of target, so they do exactly the same process for an easier target that they do for a harder target. So occasionally, one of the blocks with a hash lower than the pool's target will also be lower than the Bitcoin network target. This pays to the pool operator who can distribute the money according to contributed hashrate as measured at the pool target.</p>

CC BY-SA 4.0
2023-10-09T15:23:09.937Z
2023-10-09T15:23:09.937Z
RedGrittyBrick
<p>If the pool didn't keep a lookup table of every outstanding bit of work it offered to miners, it couldn't submit the complete block if the miner successfully found a block header. So mining pools must already keep track of all outstanding work units they've given to miners for as long as they are willing to accept shares for those work units.</p>

CC BY-SA 4.0
2023-10-11T06:59:01.113Z
I don't understand what exactly the pool is keeping on a lookup table.
Lagrang3
CC BY-SA 4.0
2023-10-11T21:01:15.367Z
@Lagrange.el.Ciencia The blocks that it asked the miners to mine. It needs a different one for each work unit it gives out or all miners would be repeating the same computations.
David Schwartz
CC BY-SA 4.0
2023-10-12T17:46:21.437Z
Not the entire block, at least the block header, or just the fields in the header that are used to change the block hash.
Lagrang3
CC BY-SA 4.0
2023-10-16T01:00:30.210Z
@Lagrange.el.Ciencia If it doesn't store the entire block, it cannot submit the block to the network if the block is successfully mined. So it must store the entire block. The blocks must be different or the miners will all be doing the same work.
David Schwartz
CC BY-SA 4.0
2023-10-09T22:11:56.223Z
2023-10-09T22:11:56.223Z
David Schwartz
<p>In a mining pool where rewards are distributed according to the fraction of hashrate contributed to the pool, could a miner misbehave trying cheating in some way? And are there strategies to prevent this?</p>
<p>I can think of one example:</p>
<h2>Bad behavior 1</h2>
<p>A miner with 1TH/s could pretend to be mining at 2TH/s by sending to the pool at regular time intervals the block headers (here I am not sure what the miner actually sends to the pool if the header or just the nonce) he is discovering plus a bunch of other headers already found in previous iterations.</p>
<h2>Solution 1</h2>
<p>This behavior does not affect the the ability of the pool to mine a block, but just inflates the reward of the bad miner, basically stealing from the other miners' share. It can be prevented if the pool keeps a lookup table of the block hashes coming from each miner and check for repeated blocks, though this seems like overkill and too expensive. Another solution could be enforcing that the miner sends the block solutions in an increasing order of the nonces, that's would be easy to verify and no repeated blocks are possible.</p>

<mining-pools>
Preventing workers bad behavior
Lagrang3
# Preventing workers bad behavior

(Asked by: username_0 on 2023-10-08)

In a mining pool where rewards are distributed according to the fraction of hashrate contributed to the pool, could a miner misbehave trying cheating in some way? And are there strategies to prevent this?

I can think of one example:

## Bad behavior 1

A miner with 1TH/s could pretend to be mining at 2TH/s by sending to the pool at regular time intervals the block headers (here I am not sure what the miner actually sends to the pool if the header or just the nonce) he is discovering plus a bunch of other headers already found in previous iterations.

## Solution 1

This behavior does not affect the the ability of the pool to mine a block, but just inflates the reward of the bad miner, basically stealing from the other miners' share. It can be prevented if the pool keeps a lookup table of the block hashes coming from each miner and check for repeated blocks, though this seems like overkill and too expensive. Another solution could be enforcing that the miner sends the block solutions in an increasing order of the nonces, that's would be easy to verify and no repeated blocks are possible.

**Tags:** mining-pools


---

## 2 answers

### Answer by username_1 on 2023-10-09. Score: 1 | Accepted answer

From [How is the network hash rate calculated?](https://bitcoin.stackexchange.com/q/11139/13866) we can see that we can calculate the applied hashrate of an entity from the network difficulty and the number of blocks produced in a specific period (e.g. in a day). The entity in the linked question is the whole bitcoin network but the method can be applied to a single node. The entity cannot fake this hashrate because they have to present sufficient blocks with hashes less than the required target.

In any reasonable measurement period (e.g. a day), a typical pool member will not produce any hashes at the current Bitcoin network target. But if the pool asks the members to present blocks with hashes less than an easier target, every period the member will be able to produce many blocks meeting that easier target. The pool operator can therefore measure contributed hashrate. As you pointed out, the pool operator has to check that hashes are not repeated. To prevent collusion each pool member would need to include a unique marker in their template so that the pool operator can check.

Note that the *method* used by the pool member to mine blocks is completely independent of target, so they do exactly the same process for an easier target that they do for a harder target. So occasionally, one of the blocks with a hash lower than the pool's target will also be lower than the Bitcoin network target. This pays to the pool operator who can distribute the money according to contributed hashrate as measured at the pool target.


---

### Answer by username_2 on 2023-10-09. Score: 1

If the pool didn't keep a lookup table of every outstanding bit of work it offered to miners, it couldn't submit the complete block if the miner successfully found a block header. So mining pools must already keep track of all outstanding work units they've given to miners for as long as they are willing to accept shares for those work units.

> **Comments:**
> **username_0**: I don't understand what exactly the pool is keeping on a lookup table.  
> **username_2**: @Lagrange.el.Ciencia The blocks that it asked the miners to mine. It needs a different one for each work unit it gives out or all miners would be repeating the same computations.  
> **username_0**: Not the entire block, at least the block header, or just the fields in the header that are used to change the block hash.  
> **username_2**: @Lagrange.el.Ciencia If it doesn't store the entire block, it cannot submit the block to the network if the block is successfully mined. So it must store the entire block. The blocks must be different or the miners will all be doing the same work.  

---

