So what's the actual max size for OP_RETURN? I know there are debates about it and how you can tweak sizes in bitcoin knots, but if a block has too much, is it just invalid? Initially, I thought it was more about the coinbase transaction size but I'm confused. I saw 80 bytes in the dev guide, but other places say 75 or even 40, which seems outdated.
How much can you actually put in OP_RETURN?
7 replies 352 views
There’s no strict consensus limit for OP_RETURN. It’s valid as long as the transaction and block follow the consensus rules. So really, the only limit is the transaction size itself: 4MB for Segwit and 1MB for non-Segwit. Standard rule says 80 bytes data plus 3 bytes for the script, but that might be changing in updates.
Yeah, it’s all about the block size really. Practically, it's just under 1MB. If OP_RETURN is in an unexecuted OP_IF branch with P2WSH, it can be up to about 4MB, but only 10k bytes max because of the script size limit.
matrix2021Full Member
Posts: 92 · Reputation: 612
#4Aug 17, 2025, 02:06 PM
Totally agree. No real consensus limits on outputs except the overall block weight. Outputs can have any opcodes, even invalid ones, until you hit that block weight limit. And the only consensus validation happens when spending the output.
I think you're right that OP_RETURN's max size depends on MAX_SCRIPT_SIZE, which is 10k. But theoretically, you could have a block with one transaction having multiple OP_RETURN outputs and hit around 3.99MB. But good luck getting that into mempool without mining your own block.
atlas_minerNewbie
Posts: 110 · Reputation: 19
#6Aug 17, 2025, 08:24 PM
Nah, that limit is only for when you spend it. The default 'datacarriersize' is just the standard max transaction size.
I doubt there's a specific OP_RETURN size that makes a block invalid. Those 75, 80, and 83 bytes are standardness rules for relaying transactions by most nodes. A transaction can be valid if it meets consensus rules, even if it’s over those limits.
Remember that OP_RETURN was called 'data carrier' initially. It started with a 40-byte limit for some app reasons, then it went to 80 bytes. So yeah, there's a limit, and if your OP_RETURN data is too big, that tx is invalid.
Related topics
- Issues with ripemd160 on Ubuntu 22 9
- New Bitcoin Improvement Proposal with $100 Reward 9
- Clipboard Vulnerabilities in Cryptocurrency Transactions 8
- Understanding the Differences Between Traditional and Simplified Chinese Mnemonics 6
- Running Bitcoin Core on a Laptop with Limited Storage 20
- Exploring Blockstream's Satellite Tech and Its Potential 22