<p>Getblocktemplate builds a block based on configuration parameters. In recent versions, the default is to use fee per byte as criterion for the entire block.</p>

<p><strong>History</strong></p>

<p>In versions of <em>Bitcoin up to 0.6</em>, priority based selection was used for the entire block. It was a means to encourage the young Bitcoin economy to grow. However, it also had a minimum transaction fee that increased as the space in blocks grew closer to the limit.</p>

<p>In <em>version 0.7</em> the <code>-blockprioritysize</code> setting was introduced, which divided blocks in a <strong>priority</strong> area and a <strong>fee</strong> area. The priority area was there to support a small number of low-fee transactions to continue, and was limited to 27 kB by default (50 kB since <em>version 0.9</em>). The fee area is sorted by fee per byte, and maximizes total fees for miners.</p>

<p><strong>Recent versions</strong></p>

<p>In <em>Bitcoin Core 0.12</em> the default setting for the priority size was reduced to 0. It also introduced a more efficient algorithm for selecting transactions, which works suboptimally for the priority area.</p>

<p>In the upcoming <em>Bitcoin Core 0.13</em> release the algorithm selection algorithm will be improved again and use Child-pays-for-parent (CPFP) logic. This logic uses fees from unconfirmed descendant transactions to determine whether to include parents. It increases the total fees that can be taken compared to the previous algorithm, and allows wallets to increase fees on a transaction by spending its change outputs with higher fee.</p>

CC BY-SA 3.0
2016-06-26T17:28:39.370Z
Thank you, Peter. Whilst I have you, does getblocktemplate return the list of transactions in any particular order?
inersha
CC BY-SA 3.0
2016-06-26T17:30:16.633Z
Yes, in the order they were selected for inclusion. This means the highest priority/fee_per_byte first.
Pieter Wuille
CC BY-SA 3.0
2016-06-26T17:23:12.957Z
2016-06-27T01:15:24.830Z
2016-06-27T01:15:24.830Z
Pieter Wuille
<p>I don't know how <code>getblocktemplate</code> works exactly, but it seems to include transactions based on <em>priority</em>.</p>

<p>Selecting transactions based on priority isn't the most profitable method for building a block (as opposed to fee/byte), so is <code>getblocktemplate</code> only going to be used by miners who haven't figured out how to construct their own blocks?</p>

<p>Why would anyone use <code>getblocktemplate</code> otherwise?</p>

<ul>
<li><a href="https://bitcoin.stackexchange.com/questions/32233/bitcoin-transaction-priority-calculation">Bitcoin transaction priority calculation</a></li>
<li><a href="https://github.com/bitcoin/bitcoin/blob/86b800c6a299455580fe76e5fb43218f0222e179/src/miner.cpp" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/86b800c6a299455580fe76e5fb43218f0222e179/src/miner.cpp</a></li>
</ul>

<mining-theory><mining-profitability><bitcoin-cli><getblocktemplate><coin-age-priority>
Why does getblocktemplate use priority for transaction selection?
inersha
# Why does getblocktemplate use priority for transaction selection?

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

I don't know how `getblocktemplate` works exactly, but it seems to include transactions based on *priority*.

Selecting transactions based on priority isn't the most profitable method for building a block (as opposed to fee/byte), so is `getblocktemplate` only going to be used by miners who haven't figured out how to construct their own blocks?

Why would anyone use `getblocktemplate` otherwise?

* [Bitcoin transaction priority calculation](https://bitcoin.stackexchange.com/questions/32233/bitcoin-transaction-priority-calculation)
* <https://github.com/bitcoin/bitcoin/blob/86b800c6a299455580fe76e5fb43218f0222e179/src/miner.cpp>

**Tags:** mining-theory, mining-profitability, bitcoin-cli, getblocktemplate, coin-age-priority


---

## 1 answers

### Answer by username_1 on 2016-06-26. Score: 4 | Accepted answer

Getblocktemplate builds a block based on configuration parameters. In recent versions, the default is to use fee per byte as criterion for the entire block.

**History**

In versions of *Bitcoin up to 0.6*, priority based selection was used for the entire block. It was a means to encourage the young Bitcoin economy to grow. However, it also had a minimum transaction fee that increased as the space in blocks grew closer to the limit.

In *version 0.7* the `-blockprioritysize` setting was introduced, which divided blocks in a **priority** area and a **fee** area. The priority area was there to support a small number of low-fee transactions to continue, and was limited to 27 kB by default (50 kB since *version 0.9*). The fee area is sorted by fee per byte, and maximizes total fees for miners.

**Recent versions**

In *Bitcoin Core 0.12* the default setting for the priority size was reduced to 0. It also introduced a more efficient algorithm for selecting transactions, which works suboptimally for the priority area.

In the upcoming *Bitcoin Core 0.13* release the algorithm selection algorithm will be improved again and use Child-pays-for-parent (CPFP) logic. This logic uses fees from unconfirmed descendant transactions to determine whether to include parents. It increases the total fees that can be taken compared to the previous algorithm, and allows wallets to increase fees on a transaction by spending its change outputs with higher fee.

> **Comments:**
> **username_0**: Thank you, Peter. Whilst I have you, does getblocktemplate return the list of transactions in any particular order?  
> **username_1**: Yes, in the order they were selected for inclusion. This means the highest priority/fee_per_byte first.  

---

