<p>Miner first validates all transactions he wants to include in the block he will mine.</p>

<p>Then from these transactions he calculates their Merkle root, that becomes the field of this block's header.</p>

<p>Then he mines (repeatedly hashes this header modifying its nonce field with each try).</p>

<p>When he finds the correct hash he broadcasts this block (including block's header and transactions) to the network.</p>

<p><em>Reasoning: It would be stupid from miner to do the expensive work of mining before making validation, risking the block to be rejected. This would mean he spent a lot of resources to mine the block in vain.</em></p>

<hr>

<p>Nodes validate the transaction before relaying it.</p>

<p><em>Reasoning: It is beneficial for network if the nodes filter invalid (erroneous, malicious) traffic. It reduces the load.</em></p>

CC BY-SA 3.0
2017-12-13T13:18:35.167Z
2017-12-13T13:31:03.983Z
2017-12-13T13:31:03.983Z
croraf
<p>Does the miner validate the transaction before putting it on the block for proof of work?
my understanding is if the miner does not validate the transaction and published the block and the block gets rejected of the invalid transaction then miner will lose the reward? 
One more question does the nodes relay the transaction after validation or they just relay it?</p>

<transaction-verification>
Does the miner first validate transaction before doing POW or he does not validate at all ?
Dheeraj Ramchandani
# Does the miner first validate transaction before doing POW or he does not validate at all ?

(Asked by: username_0 on 2017-12-13)

Does the miner validate the transaction before putting it on the block for proof of work?
my understanding is if the miner does not validate the transaction and published the block and the block gets rejected of the invalid transaction then miner will lose the reward?
One more question does the nodes relay the transaction after validation or they just relay it?

**Tags:** transaction-verification


---

## 1 answers

### Answer by username_1 on 2017-12-13. Score: 0

Miner first validates all transactions he wants to include in the block he will mine.

Then from these transactions he calculates their Merkle root, that becomes the field of this block's header.

Then he mines (repeatedly hashes this header modifying its nonce field with each try).

When he finds the correct hash he broadcasts this block (including block's header and transactions) to the network.

*Reasoning: It would be stupid from miner to do the expensive work of mining before making validation, risking the block to be rejected. This would mean he spent a lot of resources to mine the block in vain.*

---

Nodes validate the transaction before relaying it.

*Reasoning: It is beneficial for network if the nodes filter invalid (erroneous, malicious) traffic. It reduces the load.*


---

