<p>In theory, a block can contain about 111000 outputs, as outputs can be as small as 9 bytes.</p>
<p>Still, the current 4000000 block weight limit, as well as the 1000000 block size limit that predated it, were both introduced after the transaction serialization format.</p>
<p>Presumably 4 bytes was just some sort of standard choice for serializing integers. Something similar in the other direction happened would timestamps I think; they are also 4 bytes, but probably should have been larger (or less accurate).</p>

CC BY-SA 4.0
2021-12-02T05:15:07.143Z
2021-12-02T05:15:07.143Z
Pieter Wuille
<p>Realistically you're probably never going to need more than 2 bytes to represent an output index, but many of the constraints in Bitcoin aren't necessarily that closely defined to their theoretical limits. It could have been represented as a variable length integer as with other values to save a few bytes per output, but it just isn't.</p>
<blockquote>
<p>Which mined transaction on mainnet has created the highest number of outputs so far?</p>
</blockquote>
<p>The record for most outputs in a transaction is 13107 in 445KiB mined in 2016.</p>

CC BY-SA 4.0
2021-12-02T05:11:07.587Z
2021-12-02T05:11:07.587Z
Claris
<p>Using this post to define the format of a transaction: <a href="https://bitcoin.stackexchange.com/questions/84517/create-output-with-a-bunch-of-input/84520#84520">Create Output with a bunch of input</a></p>
<p>Why is the <code>previous utxo index</code> (also called the <code>previous output index</code>) 4 bytes?</p>
<p>The maximum output index should be equivalent to the maximum number of outputs that could fit into a transaction which would be constrained by block size. So is 2 bytes not enough? (2 bytes --&gt; max index of 65,535)</p>
<p>Which mined transaction on mainnet has created the highest number of outputs so far?</p>
<p>What is the largest previous output index that has been mined into a block so far?</p>
<p>Related code: <a href="https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L30" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L30</a></p>
<p>Related question: <a href="https://bitcoin.stackexchange.com/questions/85752/maximum-number-of-inputs-per-transaction/85755#85755">Maximum number of inputs per transaction</a></p>

<transactions><transaction-input>
Why is the previous output index 4 bytes?
andozw
# Why is the previous output index 4 bytes?

(Asked by: username_0 on 2021-12-02)

Using this post to define the format of a transaction: [Create Output with a bunch of input](https://bitcoin.stackexchange.com/questions/84517/create-output-with-a-bunch-of-input/84520#84520)

Why is the `previous utxo index` (also called the `previous output index`) 4 bytes?

The maximum output index should be equivalent to the maximum number of outputs that could fit into a transaction which would be constrained by block size. So is 2 bytes not enough? (2 bytes --> max index of 65,535)

Which mined transaction on mainnet has created the highest number of outputs so far?

What is the largest previous output index that has been mined into a block so far?

Related code: <https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L30>

Related question: [Maximum number of inputs per transaction](https://bitcoin.stackexchange.com/questions/85752/maximum-number-of-inputs-per-transaction/85755#85755)

**Tags:** transactions, transaction-input


---

## 2 answers

### Answer by username_1 on 2021-12-02. Score: 1 | Accepted answer

In theory, a block can contain about 111000 outputs, as outputs can be as small as 9 bytes.

Still, the current 4000000 block weight limit, as well as the 1000000 block size limit that predated it, were both introduced after the transaction serialization format.

Presumably 4 bytes was just some sort of standard choice for serializing integers. Something similar in the other direction happened would timestamps I think; they are also 4 bytes, but probably should have been larger (or less accurate).


---

### Answer by username_2 on 2021-12-02. Score: 1

Realistically you're probably never going to need more than 2 bytes to represent an output index, but many of the constraints in Bitcoin aren't necessarily that closely defined to their theoretical limits. It could have been represented as a variable length integer as with other values to save a few bytes per output, but it just isn't.

> Which mined transaction on mainnet has created the highest number of outputs so far?

The record for most outputs in a transaction is 13107 in 445KiB mined in 2016.


---

