<p>The maximum transaction size is the size of the block. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/consensus/tx_verify.cpp#L166" rel="noreferrer">Source</a>.</p>

<pre><code>// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR &gt; MAX_BLOCK_WEIGHT)
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
</code></pre>

<p>Transactions larger than 100 kilobytes (including witness at a 75% discount rate) are non-standard. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/policy/policy.h#L24" rel="noreferrer">Source 1</a>. <a href="https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/net_processing.cpp#L661-L665" rel="noreferrer">Source 2</a>.</p>

<pre><code>static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
...
if (sz &gt;= MAX_STANDARD_TX_WEIGHT)
{
    LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
    return false;
}
</code></pre>

CC BY-SA 3.0
2017-11-24T12:25:47.713Z
"Transactions larger than 100 kilobytes are non-standard" has been removed. They've removed the 100 kb limit.
MCCCS
CC BY-SA 3.0
2017-11-26T00:02:39.383Z
I disagree. It has been changed from a pure measurement of size to one of weight, but that only makes it slightly roomier - it doesn't remove it entirely.
Nick ODell
CC BY-SA 4.0
2024-03-18T12:25:02.677Z
Interesting and related: ["Non-standard transactions are frequently included by mining pools."](https://b10c.me/observations/09-non-standard-transactions/)
Lee
CC BY-SA 3.0
2015-02-03T22:02:04.243Z
2017-11-26T00:00:40.867Z
2017-11-26T00:00:40.867Z
Nick ODell
<p>If there is a max transaction size it is much higher than 100 bytes. Not sure what that snippet is refering to but the average transaction is closer to ~300 bytes looking at the average # of transactions and block size for last 1000 blocks.</p>

<p>What limits transaction size is cost.  As transaction size (of all transactions awaiting next block) increases the min required fee increases non-linearly.  </p>

<blockquote>
  <p>0.01 BTC fee per kilobyte of transaction, but: 
  If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free. 
  If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc. </p>
</blockquote>

<p><a href="https://en.bitcoin.it/wiki/Transaction_fees">https://en.bitcoin.it/wiki/Transaction_fees</a> </p>

<p>So you could make a 500KB transaction but the required minimum fee would be 5BTC.  The developers have indicated they intend to change transaction fee rules in the future but given block space is a valuable commodity any new rules are likely to be constructed to encourage (via larger fees) smaller transaction sizes.</p>

CC BY-SA 3.0
2018-01-08T14:25:58.807Z
This answer is obsolete. Blocks are full. Always.
Giszmo
CC BY-SA 3.0
2011-10-31T15:10:14.673Z
2011-10-31T15:16:08.003Z
2011-10-31T15:16:08.003Z
DeathAndTaxes
<p>I see from the source code (script.cpp) that there is an upper limit in the script size. It there any other limit to avoid a single transaction preventing other transactions of smaller sizes to get into a block?</p>

<p>How is this kind of attack prevented?</p>

<p>I've read in CTransaction::AcceptToMemoryPool the line:</p>

<pre><code>if .... ::GetSerializeSize(*this, SER_NETWORK) &lt; 100) 
    return error("..."); 
</code></pre>

<p>Does this line means that the maximum transaction size is 100 bytes?</p>

CC BY-SA 3.0
2011-10-31T15:29:59.070Z
The posted line seems to limit the minimum size, not the maximum!
SDL
<transactions>
What is the maximum size of a transaction?
SDL
# What is the maximum size of a transaction?

(Asked by: username_0 on 2011-10-31)

I see from the source code (script.cpp) that there is an upper limit in the script size. It there any other limit to avoid a single transaction preventing other transactions of smaller sizes to get into a block?

How is this kind of attack prevented?

I've read in CTransaction::AcceptToMemoryPool the line:

```
if .... ::GetSerializeSize(*this, SER_NETWORK) < 100) 
    return error("..."); 

```

Does this line means that the maximum transaction size is 100 bytes?

**Tags:** transactions

> **Comments:**
> **username_0**: The posted line seems to limit the minimum size, not the maximum!  

---

## 2 answers

### Answer by username_4 on 2011-10-31. Score: 7 | Accepted answer

If there is a max transaction size it is much higher than 100 bytes. Not sure what that snippet is refering to but the average transaction is closer to ~300 bytes looking at the average # of transactions and block size for last 1000 blocks.

What limits transaction size is cost. As transaction size (of all transactions awaiting next block) increases the min required fee increases non-linearly.

> 0.01 BTC fee per kilobyte of transaction, but:
> If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free.
> If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc.

<https://en.bitcoin.it/wiki/Transaction_fees>

So you could make a 500KB transaction but the required minimum fee would be 5BTC. The developers have indicated they intend to change transaction fee rules in the future but given block space is a valuable commodity any new rules are likely to be constructed to encourage (via larger fees) smaller transaction sizes.

> **Comments:**
> **username_5**: This answer is obsolete. Blocks are full. Always.  

---

### Answer by username_1 on 2015-02-03. Score: 25

The maximum transaction size is the size of the block. [Source](https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/consensus/tx_verify.cpp#L166).

```
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");

```

Transactions larger than 100 kilobytes (including witness at a 75% discount rate) are non-standard. [Source 1](https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/policy/policy.h#L24). [Source 2](https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/net_processing.cpp#L661-L665).

```
static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
...
if (sz >= MAX_STANDARD_TX_WEIGHT)
{
    LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
    return false;
}

```

> **Comments:**
> **username_2**: "Transactions larger than 100 kilobytes are non-standard" has been removed. They've removed the 100 kb limit.  
> **username_1**: I disagree. It has been changed from a pure measurement of size to one of weight, but that only makes it slightly roomier - it doesn't remove it entirely.  
> **username_3**: Interesting and related: ["Non-standard transactions are frequently included by mining pools."](https://b10c.me/observations/09-non-standard-transactions/)  

---

