<blockquote>
<p><strong>A. Is there a limit in the overall size of the coinbase tx?</strong></p>
</blockquote>
<p>I thought the limit for coinbase was the same as the general limit for transactions.</p>
<p><a href="https://bitcoin.stackexchange.com/q/1823/13866">What is the maximum size of a transaction?</a></p>
<p>But as <a href="https://bitcoin.stackexchange.com/users/5406/murch">Murch</a> noted:</p>
<blockquote>
<p>coinbase transactions are not subject to mempool policies and standardness rules, because they are not relayed on the network outside of the context of being included in blocks. Therefore, they are only limited by the blockweight limit instead of the weight limit of 400,000 wu for standard transactions.</p>
</blockquote>
<p>n.b. <a href="https://bitcoin.stackexchange.com/q/79629/13866">How many weight units does an input use?</a></p>
<hr />
<blockquote>
<p><strong>B. Is there a limit to the number of OP_RETURN statements in the coinbase transaction?</strong></p>
</blockquote>
<p>So far as I know, you can only have one OP_RETURN <em>in any one Bitcoin script</em>, any following data is not parsed.</p>
<p>Like any transaction, a Coinbase transaction can have many outputs, although only one input. So it can have numerous OP_RETURNs.</p>
<p>As <a href="https://bitcoin.stackexchange.com/users/208/pieter-wuille">Pieter Wuille</a> noted:</p>
<blockquote>
<p>There can be multiple OP_RETURN opcodes within a transaction output too. The typical standardness rules about OP_RETURN outputs require the opcode to be the first script byte, but again because standardness rules don't apply to coinbase transactions, that doesn't matter.</p>
</blockquote>
<p>It is probably worth saying that scripts in coinbase inputs should never get executed, although the first opcode should push the block height. Other than that, their contents can be considered as arbitrary byte data which might contain the value 0x6A (OP_RETURN) multiple times.</p>
<hr />
<blockquote>
<p><strong>C. What is the mean, median, range and general trend in the size of coinbase transactions</strong></p>
</blockquote>
<p>You can work this out if you collect data using a full node such as Bitcoin core. See</p>
<ul>
<li><a href="https://bitcoin.stackexchange.com/q/109804/13866">Open-source forensic analysis tools to analyze full-node&#39;s local copy of Bitcoin blockchain?</a></li>
<li><a href="https://bitcoin.stackexchange.com/q/114804/13866">How can I take a &quot;snapshot&quot; of the bitcoin blockchain and analyze it?</a></li>
</ul>
<p>You can write your own analytic tool using a <a href="https://www.google.com/search?client=firefox-b-d&amp;q=blockchain+parser" rel="nofollow noreferrer">blockchain parser</a>. I wrote my own parser library (unpublished) which could be used as follows</p>
<pre class="lang-go prettyprint-override"><code>package main

import (
    bc &quot;blockchain/blockchain&quot;
    &quot;fmt&quot;
    &quot;os&quot;
    &quot;time&quot;
)

func main() {
    b, err := os.ReadFile(`blk02000.dat`)
    check(&quot;Reading data&quot;, err)

    parser := bc.New(BlockHandler)
    err = parser.ParseBlocks(&amp;b)
    check(&quot;Parsing data&quot;, err)
}

// Extract length of coinbase transactions 
var i int = 1
func BlockHandler(b *bc.Block) {
    blockDate := time.Unix(int64(b.Header.TimeStamp), 0).Format(&quot;2006-01-02 15:04&quot;)
    coinbase :=  b.TransactionList[0]
    txBytes := coinbase.Size()
    fmt.Printf(&quot;Block %5d dated %s has coinbase of %5d Bytes\n&quot;,
        i, blockDate, txBytes) 
    i++
}

// Rudimentary convenience function for error handling
func check(where string, err error) {
    if err != nil {
        fmt.Println(where, err)
        os.Exit(1)
    }
}
</code></pre>
<p>results</p>
<pre><code>Block     1 dated 2020-03-14 06:24 has coinbase of   300 Bytes
Block     2 dated 2020-03-14 14:20 has coinbase of   300 Bytes
Block     3 dated 2020-03-14 08:42 has coinbase of   246 Bytes
Block     4 dated 2020-03-13 23:08 has coinbase of   300 Bytes
Block     5 dated 2020-03-14 04:19 has coinbase of   306 Bytes
Block     6 dated 2020-03-14 15:47 has coinbase of   295 Bytes
Block     7 dated 2020-03-13 14:39 has coinbase of   216 Bytes
Block     8 dated 2020-03-14 13:04 has coinbase of   362 Bytes
Block     9 dated 2020-03-14 09:31 has coinbase of   308 Bytes
Block    10 dated 2020-03-14 10:16 has coinbase of   306 Bytes
Block    11 dated 2020-03-14 15:39 has coinbase of   346 Bytes
Block    12 dated 2020-03-14 08:05 has coinbase of   377 Bytes
Block    13 dated 2020-03-14 13:48 has coinbase of   362 Bytes
Block    14 dated 2020-03-14 17:15 has coinbase of   299 Bytes
Block    15 dated 2020-03-14 06:18 has coinbase of   342 Bytes
Block    16 dated 2020-03-14 11:37 has coinbase of   377 Bytes
Block    17 dated 2020-03-14 12:35 has coinbase of   377 Bytes
Block    18 dated 2020-03-14 17:32 has coinbase of   377 Bytes
Block    19 dated 2020-03-14 13:22 has coinbase of   316 Bytes
Block    20 dated 2020-03-14 18:37 has coinbase of   291 Bytes
Block    21 dated 2020-03-14 15:10 has coinbase of   377 Bytes
Block    22 dated 2020-03-14 09:35 has coinbase of   362 Bytes
Block    23 dated 2020-03-14 12:58 has coinbase of   295 Bytes
Block    24 dated 2020-03-14 06:37 has coinbase of   317 Bytes
Block    25 dated 2020-03-14 18:46 has coinbase of   299 Bytes
Block    26 dated 2020-03-13 23:12 has coinbase of   298 Bytes
Block    27 dated 2020-03-14 16:27 has coinbase of   362 Bytes
Block    28 dated 2020-03-14 16:53 has coinbase of   377 Bytes
Block    29 dated 2020-03-14 19:04 has coinbase of   217 Bytes
Block    30 dated 2020-03-14 07:26 has coinbase of   342 Bytes
Block    31 dated 2020-03-14 13:42 has coinbase of   289 Bytes
Block    32 dated 2020-03-14 20:10 has coinbase of   295 Bytes
Block    33 dated 2020-03-14 12:32 has coinbase of   295 Bytes
Block    34 dated 2020-03-13 08:50 has coinbase of   342 Bytes
Block    35 dated 2020-03-14 18:07 has coinbase of   308 Bytes
Block    36 dated 2020-03-14 16:59 has coinbase of   263 Bytes
Block    37 dated 2020-03-14 21:43 has coinbase of   296 Bytes
Block    38 dated 2020-03-14 20:27 has coinbase of   377 Bytes
Block    39 dated 2020-03-14 18:33 has coinbase of   289 Bytes
Block    40 dated 2020-03-14 18:15 has coinbase of   290 Bytes
Block    41 dated 2020-03-14 23:05 has coinbase of   362 Bytes
Block    42 dated 2020-03-13 16:19 has coinbase of   377 Bytes
Block    43 dated 2020-03-14 13:48 has coinbase of   263 Bytes
Block    44 dated 2020-03-14 09:30 has coinbase of   308 Bytes
Block    45 dated 2020-03-14 20:07 has coinbase of   316 Bytes
Block    46 dated 2020-03-15 01:10 has coinbase of   289 Bytes
Block    47 dated 2020-03-14 19:19 has coinbase of   362 Bytes
Block    48 dated 2020-03-14 19:51 has coinbase of   300 Bytes
Block    49 dated 2020-03-14 22:40 has coinbase of   377 Bytes
Block    50 dated 2020-03-15 02:16 has coinbase of   296 Bytes
Block    51 dated 2020-03-14 21:43 has coinbase of   217 Bytes
Block    52 dated 2020-03-14 15:43 has coinbase of   308 Bytes
Block    53 dated 2020-03-14 22:42 has coinbase of   306 Bytes
Block    54 dated 2020-03-14 20:45 has coinbase of   306 Bytes
Block    55 dated 2020-03-14 12:13 has coinbase of   296 Bytes
Block    56 dated 2020-03-15 04:06 has coinbase of   342 Bytes
Block    57 dated 2020-03-15 01:09 has coinbase of   285 Bytes
Block    58 dated 2020-03-15 05:13 has coinbase of   299 Bytes
Block    59 dated 2020-03-15 00:31 has coinbase of   289 Bytes
Block    60 dated 2020-03-14 17:39 has coinbase of   308 Bytes
Block    61 dated 2020-03-15 01:12 has coinbase of   290 Bytes
Block    62 dated 2020-03-14 22:31 has coinbase of   299 Bytes
Block    63 dated 2020-03-15 08:39 has coinbase of   362 Bytes
Block    64 dated 2020-03-14 13:30 has coinbase of   295 Bytes
Block    65 dated 2020-03-15 01:45 has coinbase of   377 Bytes
Block    66 dated 2020-03-15 02:08 has coinbase of   311 Bytes
Block    67 dated 2020-03-15 03:10 has coinbase of   377 Bytes
Block    68 dated 2020-03-14 19:02 has coinbase of   290 Bytes
Block    69 dated 2020-03-15 01:31 has coinbase of   377 Bytes
Block    70 dated 2020-03-15 03:41 has coinbase of   377 Bytes
Block    71 dated 2020-03-15 09:34 has coinbase of   342 Bytes
Block    72 dated 2020-03-15 03:25 has coinbase of   285 Bytes
Block    73 dated 2020-03-14 16:20 has coinbase of   261 Bytes
Block    74 dated 2020-03-14 21:04 has coinbase of   298 Bytes
Block    75 dated 2020-03-15 04:01 has coinbase of   362 Bytes
Block    76 dated 2020-03-15 05:09 has coinbase of   377 Bytes
Block    77 dated 2020-03-15 04:32 has coinbase of   296 Bytes
Block    78 dated 2020-03-15 05:59 has coinbase of   289 Bytes
Block    79 dated 2020-03-15 03:24 has coinbase of   362 Bytes
Block    80 dated 2020-03-15 05:22 has coinbase of   377 Bytes
Block    81 dated 2020-03-14 18:40 has coinbase of   313 Bytes
Block    82 dated 2020-03-13 17:48 has coinbase of   298 Bytes
Block    83 dated 2020-03-15 10:38 has coinbase of   316 Bytes
Block    84 dated 2020-03-15 06:46 has coinbase of   362 Bytes
Block    85 dated 2020-03-15 06:28 has coinbase of   342 Bytes
Block    86 dated 2020-03-13 10:28 has coinbase of   306 Bytes
Block    87 dated 2020-03-15 06:41 has coinbase of   362 Bytes
Block    88 dated 2020-03-14 23:00 has coinbase of   306 Bytes
Block    89 dated 2020-03-15 04:09 has coinbase of   339 Bytes
Block    90 dated 2020-03-14 21:11 has coinbase of   295 Bytes
Block    91 dated 2020-03-15 11:18 has coinbase of   266 Bytes
Block    92 dated 2020-03-15 09:37 has coinbase of   306 Bytes
Block    93 dated 2020-03-15 09:07 has coinbase of   296 Bytes
Block    94 dated 2020-03-15 11:51 has coinbase of   299 Bytes
Block    95 dated 2020-03-15 09:26 has coinbase of   306 Bytes
Block    96 dated 2020-03-15 02:03 has coinbase of   289 Bytes
Block    97 dated 2020-03-15 12:26 has coinbase of   263 Bytes
Block    98 dated 2020-03-14 23:34 has coinbase of   377 Bytes
Block    99 dated 2020-03-15 10:32 has coinbase of   342 Bytes
Block   100 dated 2020-03-15 11:35 has coinbase of   342 Bytes
Block   101 dated 2020-03-15 10:51 has coinbase of   291 Bytes
Block   102 dated 2020-03-15 10:18 has coinbase of   377 Bytes
Block   103 dated 2020-03-15 05:58 has coinbase of   299 Bytes
Block   104 dated 2020-03-15 11:57 has coinbase of   306 Bytes
Block   105 dated 2020-03-15 13:38 has coinbase of   377 Bytes
Block   106 dated 2020-03-15 03:58 has coinbase of   298 Bytes
Block   107 dated 2020-03-15 02:17 has coinbase of   306 Bytes
Block   108 dated 2020-03-15 05:25 has coinbase of   296 Bytes
Block   109 dated 2020-03-15 06:43 has coinbase of   299 Bytes
Block   110 dated 2020-03-15 10:41 has coinbase of   342 Bytes
Block   111 dated 2020-03-15 12:15 has coinbase of   300 Bytes
Block   112 dated 2020-03-15 11:54 has coinbase of   299 Bytes
</code></pre>
<p>Obviously its a small step from that to accumulate min, max, median values by year. Or just feed that data into some other tool.</p>

CC BY-SA 4.0
2022-12-02T18:22:06.677Z
Thanks, the [linked coinbase tx](https://www.blockchain.com/btc/tx/4ce626bf940c954edf2457d13d38dde29a82903b8417d7551f0b31c6f9ecc398) has three OP_RETURNS, no? Perhaps I'm misunderstanding something...
Lee
CC BY-SA 4.0
2022-12-02T18:23:36.977Z
.. interesting; a miner could choose to make the coinbase tx take up the entire block
Lee
CC BY-SA 4.0
2022-12-02T19:08:35.410Z
Yes sorry, I was thinking of one OP_Return per script so one per input or output. A coinbase transaction can have many outputs. (Answer updated to clarify)
RedGrittyBrick
CC BY-SA 4.0
2022-12-02T19:25:45.107Z
Great answer. Small correction: coinbase transactions are not subject to mempool policies and standardness rules, because they are not relayed on the network outside of the context of being included in blocks. Therefore, they are only limited by the blockweight limit instead of the weight limit of 400,000 wu for standard transactions.
Murch
CC BY-SA 4.0
2022-12-02T20:26:01.100Z
@Murch: thanks for the correction. Answer updated.
RedGrittyBrick
CC BY-SA 4.0
2022-12-02T20:46:50.180Z
There can be multiple OP_RETURN opcodes within a transaction output too. The typical standardness rules about OP_RETURN outputs require the opcode to be the first script byte, but again because standardness rules don't apply to coinbase transactions, that doesn't matter.
Pieter Wuille
CC BY-SA 4.0
2022-12-02T21:13:16.937Z
@Pieter thanks. Answer updated. I'm a bit puzzled though. Don't coinbase outputs get validated by nodes so that valid outputs without OP-RETURN can be added to the UTXO list? I'll see what I can learn about standardness vs other validation/checking but more hints welcomed. I guess OP's question B is already answered adequately now though.
RedGrittyBrick
CC BY-SA 4.0
2022-12-02T21:16:43.533Z
There are almost no validity rules that apply to transaction output scripts. Most rules you'd imagine are only run when the output is attempted to be spent, but OP_RETURNs obviously can't ever be spent. There is some "shortcut" implementation rule in Bitcoin Core that detects certain subsets of outputs as unspendable, so they can avoid being inserted into the UTXO set (as they can't ever be spent anyway), but that's a local optimization and doesn't affect what transactions are valid.
Pieter Wuille
CC BY-SA 4.0
2022-12-02T17:54:03.093Z
2022-12-02T21:15:30.773Z
2022-12-02T21:15:30.773Z
RedGrittyBrick
<p><strong>A. Is there a limit in the overall size of the coinbase tx?</strong></p>
<p>Yes, but its only limited by the size of the block. A miner could choose to have the coinbase transaction fill the entire block!</p>
<p><strong>B. Is there a limit to the number of OP_RETURN statements in the coinbase transaction?</strong></p>
<p>It is only limited by the transaction size limit mentioned above.</p>
<p><strong>C. What is the mean, median, range and general trend in the size of coinbase transactions?</strong></p>
<p>Based on analysis of my local blk.*dat files (up to blk3063.dat):</p>
<p><em>Mean</em>: 259 bytes (3 sig fig)</p>
<p><em>Range-Max</em>: 168 bytes</p>
<p><em>Range-Min</em>: 90 bytes</p>
<p><sub>Range was the same for all parsed blk.dat file aside from blk0000.dat (129 - 3434 bytes)</sub></p>
<p><em>Trends in mean and median</em>:</p>
<p><a href="https://i.sstatic.net/AwHkn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AwHkn.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-12-10T10:44:38.997Z
2023-03-04T12:17:56.963Z
2023-03-04T12:17:56.963Z
Lee
<p>I'm attempting to estimate how much &quot;spare capacity&quot; there is for merged mining protocols.</p>
<p>As I understand it the scriptSig in the coinbase transaction <a href="https://bitcoin.stackexchange.com/questions/80870/what-is-the-maximum-number-of-bytes-the-coinbase-scriptsig-coinbaseaux-can-hol/80874#80874">must be less than 100B</a>. However, the miner can include multiple <code>OP_RETURN</code> statements. For instance <a href="https://www.blockchain.com/btc/tx/4ce626bf940c954edf2457d13d38dde29a82903b8417d7551f0b31c6f9ecc398" rel="nofollow noreferrer">this</a> recent block has a coinbase tx with 3 <code>OP_RETURN</code> statements and is 353 bytes.</p>
<p>A. Is there a limit in the overall size of the coinbase tx?</p>
<p>B. Is there a limit to the number of <code>OP_RETURN</code> statements in the coinbase transaction?</p>
<p>C. What is the mean, median, range and general trend in the size of coinbase transactions?</p>

<coinbase-transaction><op-return><input-script><merged-mining>
What are the mean, median, range, limits and trends in the size of coinbase transactions?
Lee
# What are the mean, median, range, limits and trends in the size of coinbase transactions?

(Asked by: username_0 on 2022-12-01)

I'm attempting to estimate how much "spare capacity" there is for merged mining protocols.

As I understand it the scriptSig in the coinbase transaction [must be less than 100B](https://bitcoin.stackexchange.com/questions/80870/what-is-the-maximum-number-of-bytes-the-coinbase-scriptsig-coinbaseaux-can-hol/80874#80874). However, the miner can include multiple `OP_RETURN` statements. For instance [this](https://www.blockchain.com/btc/tx/4ce626bf940c954edf2457d13d38dde29a82903b8417d7551f0b31c6f9ecc398) recent block has a coinbase tx with 3 `OP_RETURN` statements and is 353 bytes.

A. Is there a limit in the overall size of the coinbase tx?

B. Is there a limit to the number of `OP_RETURN` statements in the coinbase transaction?

C. What is the mean, median, range and general trend in the size of coinbase transactions?

**Tags:** coinbase-transaction, op-return, input-script, merged-mining


---

## 2 answers

### Answer by username_1 on 2022-12-02. Score: 2 | Accepted answer

> **A. Is there a limit in the overall size of the coinbase tx?**

I thought the limit for coinbase was the same as the general limit for transactions.

[What is the maximum size of a transaction?](https://bitcoin.stackexchange.com/q/1823/13866)

But as [username_2](https://bitcoin.stackexchange.com/users/5406/username_2) noted:

> coinbase transactions are not subject to mempool policies and standardness rules, because they are not relayed on the network outside of the context of being included in blocks. Therefore, they are only limited by the blockweight limit instead of the weight limit of 400,000 wu for standard transactions.

n.b. [How many weight units does an input use?](https://bitcoin.stackexchange.com/q/79629/13866)

---

> **B. Is there a limit to the number of OP\_RETURN statements in the coinbase transaction?**

So far as I know, you can only have one OP\_RETURN *in any one Bitcoin script*, any following data is not parsed.

Like any transaction, a Coinbase transaction can have many outputs, although only one input. So it can have numerous OP\_RETURNs.

As [username_3 username_3](https://bitcoin.stackexchange.com/users/208/username_3-username_3) noted:

> There can be multiple OP\_RETURN opcodes within a transaction output too. The typical standardness rules about OP\_RETURN outputs require the opcode to be the first script byte, but again because standardness rules don't apply to coinbase transactions, that doesn't matter.

It is probably worth saying that scripts in coinbase inputs should never get executed, although the first opcode should push the block height. Other than that, their contents can be considered as arbitrary byte data which might contain the value 0x6A (OP\_RETURN) multiple times.

---

> **C. What is the mean, median, range and general trend in the size of coinbase transactions**

You can work this out if you collect data using a full node such as Bitcoin core. See

* [Open-source forensic analysis tools to analyze full-node's local copy of Bitcoin blockchain?](https://bitcoin.stackexchange.com/q/109804/13866)
* [How can I take a "snapshot" of the bitcoin blockchain and analyze it?](https://bitcoin.stackexchange.com/q/114804/13866)

You can write your own analytic tool using a [blockchain parser](https://www.google.com/search?client=firefox-b-d&q=blockchain+parser). I wrote my own parser library (unpublished) which could be used as follows

```go
package main

import (
    bc "blockchain/blockchain"
    "fmt"
    "os"
    "time"
)

func main() {
    b, err := os.ReadFile(`blk02000.dat`)
    check("Reading data", err)

    parser := bc.New(BlockHandler)
    err = parser.ParseBlocks(&b)
    check("Parsing data", err)
}

// Extract length of coinbase transactions 
var i int = 1
func BlockHandler(b *bc.Block) {
    blockDate := time.Unix(int64(b.Header.TimeStamp), 0).Format("2006-01-02 15:04")
    coinbase :=  b.TransactionList[0]
    txBytes := coinbase.Size()
    fmt.Printf("Block %5d dated %s has coinbase of %5d Bytes\n",
        i, blockDate, txBytes) 
    i++
}

// Rudimentary convenience function for error handling
func check(where string, err error) {
    if err != nil {
        fmt.Println(where, err)
        os.Exit(1)
    }
}

```

results

```
Block     1 dated 2020-03-14 06:24 has coinbase of   300 Bytes
Block     2 dated 2020-03-14 14:20 has coinbase of   300 Bytes
Block     3 dated 2020-03-14 08:42 has coinbase of   246 Bytes
Block     4 dated 2020-03-13 23:08 has coinbase of   300 Bytes
Block     5 dated 2020-03-14 04:19 has coinbase of   306 Bytes
Block     6 dated 2020-03-14 15:47 has coinbase of   295 Bytes
Block     7 dated 2020-03-13 14:39 has coinbase of   216 Bytes
Block     8 dated 2020-03-14 13:04 has coinbase of   362 Bytes
Block     9 dated 2020-03-14 09:31 has coinbase of   308 Bytes
Block    10 dated 2020-03-14 10:16 has coinbase of   306 Bytes
Block    11 dated 2020-03-14 15:39 has coinbase of   346 Bytes
Block    12 dated 2020-03-14 08:05 has coinbase of   377 Bytes
Block    13 dated 2020-03-14 13:48 has coinbase of   362 Bytes
Block    14 dated 2020-03-14 17:15 has coinbase of   299 Bytes
Block    15 dated 2020-03-14 06:18 has coinbase of   342 Bytes
Block    16 dated 2020-03-14 11:37 has coinbase of   377 Bytes
Block    17 dated 2020-03-14 12:35 has coinbase of   377 Bytes
Block    18 dated 2020-03-14 17:32 has coinbase of   377 Bytes
Block    19 dated 2020-03-14 13:22 has coinbase of   316 Bytes
Block    20 dated 2020-03-14 18:37 has coinbase of   291 Bytes
Block    21 dated 2020-03-14 15:10 has coinbase of   377 Bytes
Block    22 dated 2020-03-14 09:35 has coinbase of   362 Bytes
Block    23 dated 2020-03-14 12:58 has coinbase of   295 Bytes
Block    24 dated 2020-03-14 06:37 has coinbase of   317 Bytes
Block    25 dated 2020-03-14 18:46 has coinbase of   299 Bytes
Block    26 dated 2020-03-13 23:12 has coinbase of   298 Bytes
Block    27 dated 2020-03-14 16:27 has coinbase of   362 Bytes
Block    28 dated 2020-03-14 16:53 has coinbase of   377 Bytes
Block    29 dated 2020-03-14 19:04 has coinbase of   217 Bytes
Block    30 dated 2020-03-14 07:26 has coinbase of   342 Bytes
Block    31 dated 2020-03-14 13:42 has coinbase of   289 Bytes
Block    32 dated 2020-03-14 20:10 has coinbase of   295 Bytes
Block    33 dated 2020-03-14 12:32 has coinbase of   295 Bytes
Block    34 dated 2020-03-13 08:50 has coinbase of   342 Bytes
Block    35 dated 2020-03-14 18:07 has coinbase of   308 Bytes
Block    36 dated 2020-03-14 16:59 has coinbase of   263 Bytes
Block    37 dated 2020-03-14 21:43 has coinbase of   296 Bytes
Block    38 dated 2020-03-14 20:27 has coinbase of   377 Bytes
Block    39 dated 2020-03-14 18:33 has coinbase of   289 Bytes
Block    40 dated 2020-03-14 18:15 has coinbase of   290 Bytes
Block    41 dated 2020-03-14 23:05 has coinbase of   362 Bytes
Block    42 dated 2020-03-13 16:19 has coinbase of   377 Bytes
Block    43 dated 2020-03-14 13:48 has coinbase of   263 Bytes
Block    44 dated 2020-03-14 09:30 has coinbase of   308 Bytes
Block    45 dated 2020-03-14 20:07 has coinbase of   316 Bytes
Block    46 dated 2020-03-15 01:10 has coinbase of   289 Bytes
Block    47 dated 2020-03-14 19:19 has coinbase of   362 Bytes
Block    48 dated 2020-03-14 19:51 has coinbase of   300 Bytes
Block    49 dated 2020-03-14 22:40 has coinbase of   377 Bytes
Block    50 dated 2020-03-15 02:16 has coinbase of   296 Bytes
Block    51 dated 2020-03-14 21:43 has coinbase of   217 Bytes
Block    52 dated 2020-03-14 15:43 has coinbase of   308 Bytes
Block    53 dated 2020-03-14 22:42 has coinbase of   306 Bytes
Block    54 dated 2020-03-14 20:45 has coinbase of   306 Bytes
Block    55 dated 2020-03-14 12:13 has coinbase of   296 Bytes
Block    56 dated 2020-03-15 04:06 has coinbase of   342 Bytes
Block    57 dated 2020-03-15 01:09 has coinbase of   285 Bytes
Block    58 dated 2020-03-15 05:13 has coinbase of   299 Bytes
Block    59 dated 2020-03-15 00:31 has coinbase of   289 Bytes
Block    60 dated 2020-03-14 17:39 has coinbase of   308 Bytes
Block    61 dated 2020-03-15 01:12 has coinbase of   290 Bytes
Block    62 dated 2020-03-14 22:31 has coinbase of   299 Bytes
Block    63 dated 2020-03-15 08:39 has coinbase of   362 Bytes
Block    64 dated 2020-03-14 13:30 has coinbase of   295 Bytes
Block    65 dated 2020-03-15 01:45 has coinbase of   377 Bytes
Block    66 dated 2020-03-15 02:08 has coinbase of   311 Bytes
Block    67 dated 2020-03-15 03:10 has coinbase of   377 Bytes
Block    68 dated 2020-03-14 19:02 has coinbase of   290 Bytes
Block    69 dated 2020-03-15 01:31 has coinbase of   377 Bytes
Block    70 dated 2020-03-15 03:41 has coinbase of   377 Bytes
Block    71 dated 2020-03-15 09:34 has coinbase of   342 Bytes
Block    72 dated 2020-03-15 03:25 has coinbase of   285 Bytes
Block    73 dated 2020-03-14 16:20 has coinbase of   261 Bytes
Block    74 dated 2020-03-14 21:04 has coinbase of   298 Bytes
Block    75 dated 2020-03-15 04:01 has coinbase of   362 Bytes
Block    76 dated 2020-03-15 05:09 has coinbase of   377 Bytes
Block    77 dated 2020-03-15 04:32 has coinbase of   296 Bytes
Block    78 dated 2020-03-15 05:59 has coinbase of   289 Bytes
Block    79 dated 2020-03-15 03:24 has coinbase of   362 Bytes
Block    80 dated 2020-03-15 05:22 has coinbase of   377 Bytes
Block    81 dated 2020-03-14 18:40 has coinbase of   313 Bytes
Block    82 dated 2020-03-13 17:48 has coinbase of   298 Bytes
Block    83 dated 2020-03-15 10:38 has coinbase of   316 Bytes
Block    84 dated 2020-03-15 06:46 has coinbase of   362 Bytes
Block    85 dated 2020-03-15 06:28 has coinbase of   342 Bytes
Block    86 dated 2020-03-13 10:28 has coinbase of   306 Bytes
Block    87 dated 2020-03-15 06:41 has coinbase of   362 Bytes
Block    88 dated 2020-03-14 23:00 has coinbase of   306 Bytes
Block    89 dated 2020-03-15 04:09 has coinbase of   339 Bytes
Block    90 dated 2020-03-14 21:11 has coinbase of   295 Bytes
Block    91 dated 2020-03-15 11:18 has coinbase of   266 Bytes
Block    92 dated 2020-03-15 09:37 has coinbase of   306 Bytes
Block    93 dated 2020-03-15 09:07 has coinbase of   296 Bytes
Block    94 dated 2020-03-15 11:51 has coinbase of   299 Bytes
Block    95 dated 2020-03-15 09:26 has coinbase of   306 Bytes
Block    96 dated 2020-03-15 02:03 has coinbase of   289 Bytes
Block    97 dated 2020-03-15 12:26 has coinbase of   263 Bytes
Block    98 dated 2020-03-14 23:34 has coinbase of   377 Bytes
Block    99 dated 2020-03-15 10:32 has coinbase of   342 Bytes
Block   100 dated 2020-03-15 11:35 has coinbase of   342 Bytes
Block   101 dated 2020-03-15 10:51 has coinbase of   291 Bytes
Block   102 dated 2020-03-15 10:18 has coinbase of   377 Bytes
Block   103 dated 2020-03-15 05:58 has coinbase of   299 Bytes
Block   104 dated 2020-03-15 11:57 has coinbase of   306 Bytes
Block   105 dated 2020-03-15 13:38 has coinbase of   377 Bytes
Block   106 dated 2020-03-15 03:58 has coinbase of   298 Bytes
Block   107 dated 2020-03-15 02:17 has coinbase of   306 Bytes
Block   108 dated 2020-03-15 05:25 has coinbase of   296 Bytes
Block   109 dated 2020-03-15 06:43 has coinbase of   299 Bytes
Block   110 dated 2020-03-15 10:41 has coinbase of   342 Bytes
Block   111 dated 2020-03-15 12:15 has coinbase of   300 Bytes
Block   112 dated 2020-03-15 11:54 has coinbase of   299 Bytes

```

Obviously its a small step from that to accumulate min, max, median values by year. Or just feed that data into some other tool.

> **Comments:**
> **username_0**: Thanks, the [linked coinbase tx](https://www.blockchain.com/btc/tx/4ce626bf940c954edf2457d13d38dde29a82903b8417d7551f0b31c6f9ecc398) has three OP_RETURNS, no? Perhaps I'm misunderstanding something...  
> **username_0**: .. interesting; a miner could choose to make the coinbase tx take up the entire block  
> **username_1**: Yes sorry, I was thinking of one OP_Return per script so one per input or output. A coinbase transaction can have many outputs. (Answer updated to clarify)  
> **username_2**: Great answer. Small correction: coinbase transactions are not subject to mempool policies and standardness rules, because they are not relayed on the network outside of the context of being included in blocks. Therefore, they are only limited by the blockweight limit instead of the weight limit of 400,000 wu for standard transactions.  
> **username_1**: @username_2: thanks for the correction. Answer updated.  
> **username_3**: There can be multiple OP_RETURN opcodes within a transaction output too. The typical standardness rules about OP_RETURN outputs require the opcode to be the first script byte, but again because standardness rules don't apply to coinbase transactions, that doesn't matter.  
> **username_1**: @username_3 thanks. Answer updated. I'm a bit puzzled though. Don't coinbase outputs get validated by nodes so that valid outputs without OP-RETURN can be added to the UTXO list? I'll see what I can learn about standardness vs other validation/checking but more hints welcomed. I guess OP's question B is already answered adequately now though.  
> **username_3**: There are almost no validity rules that apply to transaction output scripts. Most rules you'd imagine are only run when the output is attempted to be spent, but OP_RETURNs obviously can't ever be spent. There is some "shortcut" implementation rule in Bitcoin Core that detects certain subsets of outputs as unspendable, so they can avoid being inserted into the UTXO set (as they can't ever be spent anyway), but that's a local optimization and doesn't affect what transactions are valid.  

---

### Answer by username_0 on 2022-12-10. Score: 2

**A. Is there a limit in the overall size of the coinbase tx?**

Yes, but its only limited by the size of the block. A miner could choose to have the coinbase transaction fill the entire block!

**B. Is there a limit to the number of OP\_RETURN statements in the coinbase transaction?**

It is only limited by the transaction size limit mentioned above.

**C. What is the mean, median, range and general trend in the size of coinbase transactions?**

Based on analysis of my local blk.\*dat files (up to blk3063.dat):

*Mean*: 259 bytes (3 sig fig)

*Range-Max*: 168 bytes

*Range-Min*: 90 bytes

Range was the same for all parsed blk.dat file aside from blk0000.dat (129 - 3434 bytes)

*Trends in mean and median*:

[![enter image description here](https://i.sstatic.net/AwHkn.png)](https://i.sstatic.net/AwHkn.png)


---

