<ol>
<li><p>Miners can choose whatever transactions they wish to include in a block, as long as they are valid, but doing so may require them using custom software. As far as I'm aware, the Bitcoin Core software selects transactions by highest paying fee first.</p>
</li>
<li><p>No. The hash rate is determined by specialized hardware (ASICs) which do not perform transaction validation. The hardware does not help with the validation of transactions because it would take longer to transfer the information to this hardware than to simply perform the hashing on the CPU. The bulk of the time in validating transactions is spent on signature validation anyway, which the ASICs do not do (although it would be possible to build one for this particular purpose).</p>
<p>The mining ASICs are mainly more efficient than mining on the CPU is because they perform the hash algorithm on the same data many times, internally only updating a random number for each hash attempt and recalculating the merkle root.</p>
</li>
<li><p>Miners validate all transactions as they come from the network just like every other network participant. Their bitcoin node will hold incoming transactions in the mempool, and the mining software will request a block template at regular intervals, containing all of the transactions which are to be included in the block. In a mining pool, the pool operator creates the block template and the miners work from that template, and validating themselves it is optional.</p>
</li>
<li><p>This is quite a complex topic because every single aspect of a transaction needs validating, and the entire details are not defined in a document, but by the reference implementation (the satoshi client / bitcoin core).</p>
<p>The key details are that:</p>
<ul>
<li>All of the inputs to a transaction are checked to be unspent</li>
<li>The sum of the output amounts is less than the sum of the input amounts (with the difference being the transaction fee).</li>
<li>For each transaction input, the scriptSig from that input is pushed onto a stack, then the scriptPubKey from its matching transaction outpoint is evaluated with that stack. The script must evaluate to true for the transaction to be valid. The scriptSig will usually contain a public key and a signature, and the scriptPubKey will usually perform an <code>OP_CHECKSIG</code>, which tests that the SHA-256 of the entire transaction was signed by the private key matching the public key. (This itself is quite nuanced because the transaction must be stripped of the signature before it is signed or validated).</li>
</ul>
</li>
</ol>
<p>There are many finer details to the validation of transactions, which are mostly answered in existing questions on here, explained on the bitcoin wiki or in the BIPs.</p>

CC BY-SA 4.0
2019-04-22T06:22:50.753Z
2019-04-22T06:22:50.753Z
2020-06-16T11:10:03.350Z
Mark H
<p>I'm aware that when the hash of the block header (block hash) is below the difficulty target, a block is deemed as validated. </p>

<p>But because I've never run a bitcoin node before (will soon), I had a few questions regarding the mining process.</p>

<p>1) When miners are running the BTC software, are they by default confirming transactions in the mem pool based on the highest fees, or are they allowed to choose which transactions they may validate?</p>

<p>2) If you have a higher hash rate, does this mean you can validate transactions quicker as well? </p>

<p>3) When a block is validated on average every 10 minutes, as set by the BTC protocol, are miners also trying to validate transactions too?</p>

<p>4) How are transactions validated?</p>

<transactions><bitcoin-core><blockchain><mempool>
Hash rate, transaction and block relationship
TheRoadLessTaken
# Hash rate, transaction and block relationship

(Asked by: username_0 on 2019-04-22)

I'm aware that when the hash of the block header (block hash) is below the difficulty target, a block is deemed as validated.

But because I've never run a bitcoin node before (will soon), I had a few questions regarding the mining process.

1) When miners are running the BTC software, are they by default confirming transactions in the mem pool based on the highest fees, or are they allowed to choose which transactions they may validate?

2) If you have a higher hash rate, does this mean you can validate transactions quicker as well?

3) When a block is validated on average every 10 minutes, as set by the BTC protocol, are miners also trying to validate transactions too?

4) How are transactions validated?

**Tags:** transactions, bitcoin-core, blockchain, mempool


---

## 1 answers

### Answer by username_1 on 2019-04-22. Score: 1

1. Miners can choose whatever transactions they wish to include in a block, as long as they are valid, but doing so may require them using custom software. As far as I'm aware, the Bitcoin Core software selects transactions by highest paying fee first.
2. No. The hash rate is determined by specialized hardware (ASICs) which do not perform transaction validation. The hardware does not help with the validation of transactions because it would take longer to transfer the information to this hardware than to simply perform the hashing on the CPU. The bulk of the time in validating transactions is spent on signature validation anyway, which the ASICs do not do (although it would be possible to build one for this particular purpose).

   The mining ASICs are mainly more efficient than mining on the CPU is because they perform the hash algorithm on the same data many times, internally only updating a random number for each hash attempt and recalculating the merkle root.
3. Miners validate all transactions as they come from the network just like every other network participant. Their bitcoin node will hold incoming transactions in the mempool, and the mining software will request a block template at regular intervals, containing all of the transactions which are to be included in the block. In a mining pool, the pool operator creates the block template and the miners work from that template, and validating themselves it is optional.
4. This is quite a complex topic because every single aspect of a transaction needs validating, and the entire details are not defined in a document, but by the reference implementation (the satoshi client / bitcoin core).

   The key details are that:

   * All of the inputs to a transaction are checked to be unspent
   * The sum of the output amounts is less than the sum of the input amounts (with the difference being the transaction fee).
   * For each transaction input, the scriptSig from that input is pushed onto a stack, then the scriptPubKey from its matching transaction outpoint is evaluated with that stack. The script must evaluate to true for the transaction to be valid. The scriptSig will usually contain a public key and a signature, and the scriptPubKey will usually perform an `OP_CHECKSIG`, which tests that the SHA-256 of the entire transaction was signed by the private key matching the public key. (This itself is quite nuanced because the transaction must be stripped of the signature before it is signed or validated).

There are many finer details to the validation of transactions, which are mostly answered in existing questions on here, explained on the bitcoin wiki or in the BIPs.


---

