[BIP Proposal] Limit ScriptPubkey Size >= 520 Bytes Consensus.

1,660 views
Skip to first unread message

PortlandHODL

unread,
Oct 2, 2025, 5:59:24 PMOct 2
to Bitcoin Development Mailing List
Proposing: Softfork to after (n) block height; the creation of outpoints with greater than 520 bytes in the ScriptPubkey would be consensus invalid.

This is my gathering of information per BIP 0002

After doing some research into the number of outpoints that would have violated the proposed rule there are exactly 169 outpoints. With only 8 being non OP_RETURN. I think after 15 years and not having discovered use for 'large' ScriptPubkeys; the reward for not invalidating them at the consensus level is lower than the risk of their abuse. 
  • Reasons for
    • Makes DoS blocks likely impossible to create that would have any sufficient negative impact on the network.
    • Leaves enough room for hooks long term
    • Would substantially reduce the divergence between consensus  and relay policy
    • Incredibly little use onchain as evidenced above.
    • Could possibly reduce codebase complexity. Legacy Script is largely considered a mess though this isn't a complete disablement it should reduce the total surface that is problematic.
    • Would make it harder to use the ScriptPubkey as a 'large' datacarrier.
    • Possible UTXO set size bloat reduction.

  • Reasons Against 
    • Bitcoin could need it in the future? Quantum?
    • Users could just create more outpoints.
Thoughts?

source of onchain data 

PortlandHODL

Andrew Poelstra

unread,
Oct 2, 2025, 6:31:40 PMOct 2
to PortlandHODL, Bitcoin Development Mailing List
On Thu, Oct 02, 2025 at 01:42:06PM -0700, PortlandHODL wrote:
> Proposing: Softfork to after (n) block height; the creation of outpoints
> with greater than 520 bytes in the ScriptPubkey would be consensus invalid.
>

Personally, I like this. Unlike restrictions on opcode behavior or
witness data, it is impossible for there to be any existing UTXOs which
"might turn out to need" scriptpubkeys greater than 520 bytes. In a
post-covenant world I suppose this could change.

There is a risk of confiscation of coins which have pre-signed but
unpublished transactions spending them to new outputs with large
scriptPubKeys. Due to long-standing standardness rules, and the presence
of P2SH (and now P2WSH) for well over a decade, I'm skeptical that any
such transactions exist.

In any case, if confiscation is a worry, as always we can exempt the
current UTXO set from the rule -- if you are only spending outputs that
existed prior to the new rule, your new UTXOs are allowed to be large.


I would even suggest going lower than 520 bytes.


--
Andrew Poelstra
Director, Blockstream Research
Email: apoelstra at wpsoftware.net
Web: https://www.wpsoftware.net/andrew

The sun is always shining in space
-Justin Lewis-Webster

signature.asc

Brandon Black

unread,
Oct 2, 2025, 6:31:53 PMOct 2
to PortlandHODL, Bitcoin Development Mailing List
Love this idea.

I think "users will just use more outputs" is the one argument against. But with witness size not limited in this way, I don't see that being a problem.

If this avoids any of the fiddliness involved in avoiding DOS with GCC, I think we should do it.

Best,

Brandon
--Brandon, sent by an Android

Oct 2, 2025 15:00:22 PortlandHODL <ad...@qrsnap.io>:

--
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/6f6b570f-7f9d-40c0-a771-378eb2c0c701n%40googlegroups.com.

Andrew Poelstra

unread,
Oct 2, 2025, 6:49:19 PMOct 2
to PortlandHODL, Bitcoin Development Mailing List
On Thu, Oct 02, 2025 at 10:19:43PM +0000, Andrew Poelstra wrote:
> On Thu, Oct 02, 2025 at 01:42:06PM -0700, PortlandHODL wrote:
> > Proposing: Softfork to after (n) block height; the creation of outpoints
> > with greater than 520 bytes in the ScriptPubkey would be consensus invalid.
> >
>
> Personally, I like this. Unlike restrictions on opcode behavior or
> witness data, it is impossible for there to be any existing UTXOs which
> "might turn out to need" scriptpubkeys greater than 520 bytes. In a
> post-covenant world I suppose this could change.
>
> There is a risk of confiscation of coins which have pre-signed but
> unpublished transactions spending them to new outputs with large
> scriptPubKeys. Due to long-standing standardness rules, and the presence
> of P2SH (and now P2WSH) for well over a decade, I'm skeptical that any
> such transactions exist.
>

To add to this -- if we whitelisted existing UTXOs to preserve the
validity of pre-signed transactions, this still might not be enough;
there could be arbitrarily long chains of pre-signed transaction.

This is still possible to overcome -- we whitelist all existing UTXOs,
their descendants (UTXOs created from transactions which only spend
existing UTXOs), and so on. The result would be that from the point
of activation, new coinbase outputs would have limited size, as would
their children, and so on, and the limit would spread outward.

I don't think this is a great idea -- it would be technically hard to
implement and slow deployment indefinitely. But I am bringing it up
so people are aware that it's possible to address the confiscation
issue, no matter how rigid you are about it.
signature.asc

moonsettler

unread,
Oct 2, 2025, 6:49:35 PMOct 2
to Andrew Poelstra, PortlandHODL, Bitcoin Development Mailing List
Hi All,

Agreed, this is something we should consider.

> I would even suggest going lower than 520 bytes.

200 should be enough.

If this should apply to OP_RETURN (nulldata) or not, is something I can't make my mind up on.

BR,
moonsettler

Sent with Proton Mail secure email.
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/aN76f2wKPHFcj8qt%40mail.wpsoftware.net.

Garlo Nicon

unread,
Oct 3, 2025, 4:57:19 AMOct 3
to moonsettler, Andrew Poelstra, PortlandHODL, Bitcoin Development Mailing List
> 200 should be enough.

Maybe. But "520" is a battle-tested value, when it comes to the maximum allowed stack push. Picking "520" should be safe enough, and it has a higher chances to be accepted as a new consensus rule. Also, if it turns out, that a lower limit, like "200" is enough, then it can be lowered later (but bumping it would be much harder).


> If this should apply to OP_RETURN (nulldata) or not, is something I can't make my mind up on.

I think it should be applied everywhere. And if someone needs a larger OP_RETURN, then that Script can be taken, wrapped into TapScript branch, and included to any Taproot address.

/dev /fd0

unread,
Oct 3, 2025, 4:58:48 AMOct 3
to Bitcoin Development Mailing List
Hi portlandhodl,

We can't predict future usage, so it would be great if this was restricted to OP_RETURN. While there is no real use for a scriptPubKey larger than 520 bytes as shown in the data you shared, it is possible that users may create more OP_RETURN outputs after this change. It does not affect the UTXO set but will cost more and economically discourage the use of multiple OP_RETURN outputs.

/dev/fd0
floppy disk guy

moonsettler

unread,
Oct 3, 2025, 7:03:09 AMOct 3
to /dev /fd0, Bitcoin Development Mailing List
Hi Floppy,

There are only weak arguments for this proposal to extend to OP_RETURN, at least nothing I would normally entertain;
but also there are weak arguments to make an exception for OP_RETURN explicitly.

People could just add many OP_RETURNs to a transaction, that makes it more cumbersome and marginally more expensive.

BR,
moonsettler


On Friday, October 3rd, 2025 at 10:58 AM, /dev /fd0 <alice...@gmail.com> wrote:

> Hi portlandhodl,
>
> We can't predict future usage, so it would be great if this was restricted to OP_RETURN. While there is no real use for a scriptPubKey larger than 520 bytes as shown in the data you shared, it is possible that users may create more OP_RETURN outputs after this change. It does not affect the UTXO set but will cost more and economically discourage the use of multiple OP_RETURN outputs.
>
> /dev/fd0
> floppy disk guy
> On Friday, October 3, 2025 at 3:29:24 AM UTC+5:30 PortlandHODL wrote:
>
> > Proposing: Softfork to after (n) block height; the creation of outpoints with greater than 520 bytes in the ScriptPubkey would be consensus invalid.
> >
> > This is my gathering of information per BIP 0002
> >
> > After doing some research into the number of outpoints that would have violated the proposed rule there are exactly 169 outpoints. With only 8 being non OP_RETURN. I think after 15 years and not having discovered use for 'large' ScriptPubkeys; the reward for not invalidating them at the consensus level is lower than the risk of their abuse.
> >
> > - Reasons for
> > - Makes DoS blocks likely impossible to create that would have any sufficient negative impact on the network.
> > - Leaves enough room for hooks long term
> > - Would substantially reduce the divergence between consensus and relay policy
> > - Incredibly little use onchain as evidenced above.
> > - Could possibly reduce codebase complexity. Legacy Script is largely considered a mess though this isn't a complete disablement it should reduce the total surface that is problematic.
> > - Would make it harder to use the ScriptPubkey as a 'large' datacarrier.
> > - Possible UTXO set size bloat reduction.
> >
> > - Reasons Against
> > - Bitcoin could need it in the future? Quantum?
> > - Users could just create more outpoints.
> >
> > Thoughts?
> >
> > source of onchain data
> >
> > PortlandHODL
>
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/842930fb-bede-408a-8380-776d4be4e094n%40googlegroups.com.

/dev /fd0

unread,
Oct 3, 2025, 11:51:21 AMOct 3
to moonsettler, Bitcoin Development Mailing List
Hi moonsettler,

> People could just add many OP_RETURNs to a transaction, that makes it more cumbersome and marginally more expensive.

This is exactly what I wrote in my email and I consider it a positive thing. I think we are just looking at this proposal from different perspectives.

/dev/fd0
floppy disk guy

Peter Todd

unread,
Oct 3, 2025, 11:51:42 AMOct 3
to PortlandHODL, Bitcoin Development Mailing List
On Thu, Oct 02, 2025 at 01:42:06PM -0700, PortlandHODL wrote:
> Proposing: Softfork to after (n) block height; the creation of outpoints
> with greater than 520 bytes in the ScriptPubkey would be consensus invalid.
>
> This is my gathering of information per BIP 0002
>
> After doing some research into the number of outpoints that would have
> violated the proposed rule there are exactly 169 outpoints. With only 8
> being non OP_RETURN. I think after 15 years and not having discovered use
> for 'large' ScriptPubkeys; the reward for not invalidating them at the
> consensus level is lower than the risk of their abuse.
>
> -
> *Reasons for *
> - Makes DoS blocks likely impossible to create that would have any
> sufficient negative impact on the network.

Further restricting v0 scripts is sufficient to achieve this goal. We do not
need to actually prohibit >520 byte pushes.

> - Leaves enough room for hooks long term
> - Would substantially reduce the divergence between consensus and
> relay policy
> - Incredibly little use onchain as evidenced above.
> - Could possibly reduce codebase complexity. Legacy Script is largely
> considered a mess though this isn't a complete disablement it should reduce
> the total surface that is problematic.
> - Would make it harder to use the ScriptPubkey as a 'large'
> datacarrier.
> - Possible UTXO set size bloat reduction.
>
> - *Reasons Against *
> - Bitcoin could need it in the future? Quantum?

NACK, for exactly this reason. It's hard to predict what kind of math will be
needed in the future for future signature algorithms. With taproot, we include
bare pubkeys in scriptPubKeys for a good reason. It's quite possible that we'll
want to do something similar with >520byte pubkeys for some future signature
algorithm (e.g. quantum hard) or some other difficult to predict technical
upgrade (the spendableness of scriptPubKeys with >520bytes isn't relevant to
this discussion).

> - Users could just create more outpoints.

The second reason for my NACK. It makes no significant difference whether or
not data is contiguous or split across multiple outputs. All the same concerns
about arbitrary data ("spam") exist and will continue to be argued over even if
we do a soft-fork to prohibit this. All we'll done is have used up valuable dev
and political resources.

--
https://petertodd.org 'peter'[:-1]@petertodd.org
signature.asc

jeremy

unread,
Oct 3, 2025, 11:52:11 AMOct 3
to Bitcoin Development Mailing List
I think that this type of rule is OK if we do it as a "sunsetting" restriction -- e.g. a soft fork active for the next N blocks (N = e.g. 2 years, 5 years, 10 years).

We may yet find a compelling use for larger scriptpubkeys, and to me the interactions between different key types is non-obvious.

An example of where big SPK is valuable v.s. e.g. Taproot, Segwit, P2SH is if there is one big script path required in a two-tx protocol, and the inclusion price must be paid by the proposed of the first tx. In this case, we'd want the inclusion guaranteed by the first tx and then the cost isn't paid (other than satisfaction cost).

You can argue against this example probably, but it is worth considering that absence of evidence of use is not evidence of absence of use and I myself feel that overall our understanding of Bitcoin transaction programming possibilities is still early.  If you don't like this example, I can give you others (probably).

As such, I'm NACK on a permanent restriction on what could be a valuable use. But I do think it could be reasonable to set up an auto-renewing restriction on a 1-2 year basis, and allow it to be removed if we later decide we want them.

(N.B. this differs from past temporary soft fork proposals as it's a restriction on something we think no one will do that we eventually lift, rather than removing after a time an opcode that we expect people would want to rely on.)

/dev /fd0

unread,
Oct 3, 2025, 11:52:28 AMOct 3
to Andrew Poelstra, Bitcoin Development Mailing List
Hi Andrew,

> Restricting it to OP_RETURN would have zero effect on people trying to use scriptpubkeys for data storage.

1. The data shows that nobody is using scriptPubKeys for more than 520 bytes. In fact, people have found new ways to encode data in transactions. Example: [Merkle path][0] in taproot control block

2. If this applies to all scriptPubKeys, it could negatively affect the [UTXO set][1] size because multiple outputs is an alternative if someone really wants to use scriptPubKey for data.

[0]: https://mempool.space/tx/c5714af322cd2ba94adf3d74325eb17f03d029ad2bf47dc54c3d929833c02628
[1]: https://mainnet.observer/charts/utxoset-size/

/dev/fd0
floppy disk guy

On Fri, Oct 3, 2025 at 7:29 PM Andrew Poelstra <apoe...@wpsoftware.net> wrote:
On Thu, Oct 02, 2025 at 06:21:18PM -0700, /dev /fd0 wrote:
>
> We can't predict future usage,

Aside from proof-of-publication (i.e. data storage directly in the UTXO
set) there is no usage of script which can't be equally (or better)
accomplished by using a Segwit v0 or Taproot script.


> so it would be great if this was restricted
> to OP_RETURN. While there is no real use for a scriptPubKey larger than 520
> bytes as shown in the data you shared, it is possible that users may create
> more OP_RETURN outputs after this change. It does not affect the UTXO set
> but will cost more and economically discourage the use of multiple
> OP_RETURN outputs.
>

Restricting it to OP_RETURN would have zero effect on people trying to
use scriptpubkeys for data storage. They would switch to any of the 65
or so other OP_RETURN equivalents, and failing that, switch to
OP_RESERVED, then to OP_FALSE, then to `0 1 EQVERIFY`, and so on. A
restriction that applies specifically to OP_RETURN outputs is no
restriction at all.

Andrew Poelstra

unread,
Oct 3, 2025, 11:52:43 AMOct 3
to /dev /fd0, Bitcoin Development Mailing List
On Thu, Oct 02, 2025 at 06:21:18PM -0700, /dev /fd0 wrote:
>
> We can't predict future usage,

Aside from proof-of-publication (i.e. data storage directly in the UTXO
set) there is no usage of script which can't be equally (or better)
accomplished by using a Segwit v0 or Taproot script.

> so it would be great if this was restricted
> to OP_RETURN. While there is no real use for a scriptPubKey larger than 520
> bytes as shown in the data you shared, it is possible that users may create
> more OP_RETURN outputs after this change. It does not affect the UTXO set
> but will cost more and economically discourage the use of multiple
> OP_RETURN outputs.
>

signature.asc

Andrew Poelstra

unread,
Oct 3, 2025, 11:53:28 AMOct 3
to /dev /fd0, Bitcoin Development Mailing List
On Fri, Oct 03, 2025 at 07:48:38PM +0530, /dev /fd0 wrote:
> Hi Andrew,
>
> > Restricting it to OP_RETURN would have zero effect on people trying to
> use scriptpubkeys for data storage.
>
> 1. The data shows that nobody is using scriptPubKeys for more than 520
> bytes. In fact, people have found new ways to encode data in transactions.
> Example: [Merkle path][0] in taproot control block
>

I'm relieved to hear this -- if you must embed data it is much cheaper
to do so in witness data, exactly because this data puts less load on
the network (in particular it does not need to be stored by non-archival
nodes).

Unfortunately, the evidence from the current "filters" debate, where in
the current 80-byte policy limit is filtering transactions that actually
appear in blocks, suggests that we just need to wait for the "on-chain
bitcoin spam" market to have a shift in sentiment before we have people
blowing past 520 bytes or beyond.

Adding a hard consensus limit seems harmless, and will put a hard
barrier against any such sentiment shifts.

If "it's cheaper to use witness data" were enough of a barrier, nobody
would be using OP_RETURN outputs today except for opentimestamps and
maybe some other super-low-load applications.

> 2. If this applies to all scriptPubKeys, it could negatively affect the
> [UTXO set][1] size because multiple outputs is an alternative if someone
> really wants to use scriptPubKey for data.
>

Good point! But if they are forced to use multiple outputs this will
increase the cost for them even further (and force them to split up
their data, which may force some technical pain even if the network
fees aren't enough).

I'm no spammer sociologist, but at some point if we can force the cost
difference between witness spam and UTXO-set spam high enough, nobody
will choose the latter, right?

And if not -- one of the most serious problems with spam is that it
muscles out protocols like LN or Ark by out-spending them on block
space, preventing them from gaining the network effects they would
need to spend a comparable amount. Every marginal cost we add to
spammers increases the delta by which they need to out-spend.
signature.asc

Anthony Towns

unread,
Oct 3, 2025, 11:54:05 AMOct 3
to PortlandHODL, Bitcoin Development Mailing List
On Thu, Oct 02, 2025 at 01:42:06PM -0700, PortlandHODL wrote:
> Proposing: Softfork to after (n) block height; the creation of outpoints
> with greater than 520 bytes in the ScriptPubkey would be consensus invalid.

> - Leaves enough room for hooks long term
> - Bitcoin could need it in the future?

One place where large scriptPubKeys could be useful is in script caching.

Suppose we have a future where complicated smart contracts are common;
eg perhaps some future version of lightning implemented using opcodes
from the great-script-restoration has a 9,000 byte script that is
used for every uncooperative close, and that lightning is so prevelant,
uncooperative closes are common.

In that scenario, we might like to be able to cache the 9,000 byte
script, and just invoke it by reference. One way to do that would
be to hardcode that script into consensus and soft-fork it in as a
new opcode. A more flexible alternative, however, would be to put that
script in our existing database, ie the utxo set, and look it up via its
36 bit txid/vout reference. To avoid permanently bloating the utxo set,
we could make such outputs expire after perhaps 100k blocks, and perhaps
increase the "weight" of creating such utxos by 10x, so that it's only
economical if the script is going to be used ~40x before it expires.

Using the utxo set here rather than creating a new database makes upgrades
easier; you don't have to rescan blocks to populate the script cache
database once you upgrade to a node version supporting script caching.

So I think there's potential uses for this flexibility that it wouldn't
be wise to just throw away.

(If you restricted the change to only applying to scripts that used
non-push operators, that would probably still provide upgrade flexibility
while also preventing potential script abuses. But it wouldn't do anything
to prevent publishing data)

> - Possible UTXO set size bloat reduction.

I don't think this works -- breaking up a scriptPubKey across multiple
utxos increases the utxo set bloat significantly, as in addition to the
scriptPubKey, each utxo includes a key (the 36 bytes for txid and vout),
an amount (8 bytes), a coinbase flag and a height (4 bytes), and likely
additional indexing data to keep lookups efficient.

If you're putting 10kB into the utxo set, then that's perhaps 50B of
overhead for a single entry (ie 0.5%); if you have to split it into 20x
500B entries with 50B overhead each, that's 1kB of overhead in total
(ie 10%).

> - Would make it harder to use the ScriptPubkey as a 'large'
> datacarrier.

This seems to be a bad goal to me; ie one that doesn't achieve anything
positive in reducing the bad things you want to prevent, but does make
things worse for other users you want to support. Breaking up data
and recovering it is straightforward, and already supported by various
Bitcoin-specific systems already; all breaking up the data achieves is
to use up slightly more resources. If the data being sent is already
economically marginal, that may result in less data being sent --
but only a similar reduction to what you'd get if fees increased at a
similar rate. When the data storage use case is not economically marginal,
it will instead just result in less resources remaining available for
whatever monetary activity is still taking place.

As far as the "but contiguous data will be regulated more strictly"
argument goes; I don't think "your honour, my offensive content has
strings of 4d0802 every 520 bytes, and as they say: if the data doesn't
flow, you must let me go" is an argument that will fly. Having the data
be separated by longer strings or otherwise structured differently isn't
a bigger difference between an image in a bmp, a jpg, or one dumped
in a zip file or mime-encoded, and none of those will let you avoid a
regulator's ire.

Cheers,
aj

Anthony Towns

unread,
Oct 3, 2025, 12:33:20 PMOct 3
to Andrew Poelstra, Bitcoin Development Mailing List
On Fri, Oct 03, 2025 at 02:59:32PM +0000, Andrew Poelstra wrote:
> If "it's cheaper to use witness data" were enough of a barrier, nobody
> would be using OP_RETURN outputs today except for opentimestamps and
> maybe some other super-low-load applications.

It isn't chepaer to use witness data until you're publishing more than
~143 bytes of data, due to the overhead of the setup transaction. (It's
also not cheaper if you want extremely easy proof of publication of
the data)

Excluding the couple of months between the topic of increasing the
OP_RETURN limit was raised on this list and the increased limit was
merged into Bitcoin Core master, there have, in fact, been very few
OP_RETURN outputs generated that are above the ~143B size. In particular,
between blocks 900k and 915,843 I get:

15,003,149 total OP_RETURN outputs
131 OP_RETURN outputs larger than 83 bytes
81 OP_RETURN outputs of 144 bytes or more
19,707 OP_RETURN outputs with non-zero value

cf https://github.com/bitcoin/bitcoin/pull/33453#issuecomment-3341177765

Cheers,
aj

moonsettler

unread,
Oct 3, 2025, 1:23:23 PMOct 3
to Peter Todd, PortlandHODL, Bitcoin Development Mailing List

> NACK, for exactly this reason. It's hard to predict what kind of math will be
> needed in the future for future signature algorithms. With taproot, we include
> bare pubkeys in scriptPubKeys for a good reason. It's quite possible that we'll
> want to do something similar with >520byte pubkeys for some future signature
>
> algorithm (e.g. quantum hard) or some other difficult to predict technical
> upgrade (the spendableness of scriptPubKeys with >520bytes isn't relevant to
>
> this discussion).

No matter how large a pubkey script you need, you can just delegate to the
witness if you have a cryptographically secure hash function.

Hard to even imagine needing anywhere near 4096 bits for that.

The going assumption for quantum algos is they could halve the bit strength of
a hash function, but SHA512 seems quiet robust even under worst assumptions.
And it's not enough to find ANY collision for a script or some Merkle root.

Putting the unlocking conditions into the UTXO set does not seem like a healthy
idea to me anyhow.

BR,
moonsettler

PS:
No hard opinion on temporary vs final restrictions. I wouldn't worry about it.


Sent with Proton Mail secure email.

> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/aN_N4i4zZ5Dt8TdG%40petertodd.org.

Luke Dashjr

unread,
Oct 3, 2025, 4:09:09 PMOct 3
to bitco...@googlegroups.com

If we're going this route, we should just close all the gaps for the immediate future:

- Limit (new) scriptPubKeys to 83 bytes or less. 34 doesn't seem terrible. UTXOs are a huge cost to nodes, we should always keep them as small as possible. Anything else can be hashed (if SHA256 is broken, we need a hardfork anyway).

- Limit script data pushes to 256 bytes, with an exception for BIP16 redeem scripts.

- Make undefined witness/taproot versions invalid, including the annex and OP_SUCCESS*. To make any legitimate usage of them, we need a softfork anyway (see below about expiring this).

- Limit taproot control block to 257 bytes (128 scripts max), or at least way less than it currently is. 340e36 scripts is completely unrealistic.

- Make OP_IF invalid inside Tapscript. It should be unnecessary with taproot, and has only(?) seen abuse.

We can do these all together in a temporary softfork that self-expires after a year or two. This would buy time to come up with longer-term solutions, and observe how it impacts the real world. Since it expires, other softforks making use of upgradable mechanisms can just wait it out for those mechanisms to become available again - therefore we basically lose nothing. (This is intended to buy us time, not as a permanent fix.)

Alternatively, but much more complex, we could redesign the block weight metric so the above limits could be exceeded, but at a higher weight-per-byte; perhaps weigh data 25% more per byte beyond the expected size. This could also be a temporary softfork, perhaps with a rolling window, so future softforks could be free to lower weights should they be needed.

Another idea might be to increase the weight based on coin-days-destroyed/coin-age, so rapid churn has a higher feerate than occasional settlements. But this risks encouraging UTXO bloat, so needs careful consideration to proceed further.

Happy to throw together a BIP and/or code if there's community support for this.

Luke

--
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.

/dev /fd0

unread,
Oct 3, 2025, 6:46:16 PMOct 3
to Luke Dashjr, bitco...@googlegroups.com
Hi Luke,

> We can do these all together in a temporary softfork that self-expires after a year or two. 

That sounds reasonable and it could work if we can agree on the specifics of this proposal. As Jeremy also mentioned in his email, we could set up an auto-renewing restriction lasting 1–2 years with the option to remove it later if we decide we want to.

/dev/fd0
floppy disk guy

jeremy

unread,
Oct 4, 2025, 7:39:49 PMOct 4
to Bitcoin Development Mailing List

- Limit taproot control block to 257 bytes (128 scripts max), or at least way less than it currently is. 340e36 scripts is completely unrealistic.


this is a misunderstanding of taptree's depth purpose, which is not to bound the number of elements directly.

It's a bound on the huffman encoding to optimize for on-chain cost with many scripts and known likelihood of execution.

So the right way to constrain taproot is by bounding the minimum probability of script execution. E.g., if it's one-in-4 billion chance of executing, then you'd need depth 32.

128 depth was chosen because if a branch is (2^128 -1)/2^128 unlikely to execute, then it's negligibly likely, the same order of probability as being able to e.g. brute force a key. 

Guus Ellenkamp

unread,
Oct 5, 2025, 6:24:42 AMOct 5
to bitco...@googlegroups.com
If there are really so few OP_RETURN outputs more than 144 bytes, then
why increase the limit if that change is so controversial? It seems
people who want to use a larger OP_RETURN size do it anyway, even with
the current default limits.

Luke Dashjr

unread,
Oct 5, 2025, 7:19:45 AMOct 5
to bitco...@googlegroups.com

Yes, sorry if I was unclear. The temporary restriction of 257 B is ultimately based on the size, which doesn't accommodate for that design ideal. It's a tradeoff until a better solution is implemented. While it might not be optimal in all cases to have 128 scripts, the fact remains that size/depth _allows for it_. (And 128 depth is still unrealistic, even if you don't like the script-count framing.)

Luke

Greg Tonoski

unread,
Oct 8, 2025, 12:24:43 PM (11 days ago) Oct 8
to bitco...@googlegroups.com
I'm for all the consensus proposals below and would further specify:
- limiting the maximum size of the scriptPubKey of a transaction to 67 bytes (to keep supporting P2PK and avoid impacting usability/compatibility of old, deprecated software and risk of similar corner cases); good riddance to P2MS;
- limit the maximum size of script data pushes to 73 bytes (for the same reason, i.e. keep supporting for P2PK input: signature with its encoding overhead; also P2PKH) "with an exception for BIP16 redeem scripts [which may embed multiple public keys for multisig]",
- rule out "OP_FALSE OP_IF" (CVE-2023-50428),
- discontinue P2SPAM (the one that repurposed the mnemonic OP_RETURN and was standardized in 2014, commit a79342479f577013f2fd2573fb32585d6f4981b3).

BTW I think we should also consider consensus-wise limit on the maximum size of the so-called Witness field (3600 bytes max. by policy.h) along with max. size (80 bytes max. by policy.h) and max. count of its items (100 by policy.h). Any suggestions, anybody?

-- 
Greg Tonoski

Keagan McClelland

unread,
Oct 8, 2025, 2:17:23 PM (11 days ago) Oct 8
to Greg Tonoski, bitco...@googlegroups.com
Hard NACK on capping the witness size as that would effectively ban large scripts even in the P2SH wrapper which undermines Bitcoin's ability to be an effectively programmable money.

The issue is that if you do that then you effectively make script unusable for complex scripting or anything related to ZKPs. At that point you may as well just remove script altogether and just make Bitcoin a key-only currency, which I think would be silly. I think making Bitcoin safely more programmable should be the goal, not hamstringing what can be done with script by capping the witness size. The "spam" (which I'll remind people is an incoherent idea in a leaderless system) is a symptom of the inability for a robust fee market to develop for block space.

I am hesitant to limit the scriptPubKey all the way down to 67 bytes. Although it may be compelling to tighten it up as restrictively as possible, if we find a reason to increase it again, it either has to be done via a hard fork or via a significantly more complicated and subversive mechanism. I think a gradual tightening based off of concrete observations in the wild is a much more prudent approach.

Keags

Casey Rodarmor

unread,
Oct 15, 2025, 7:45:59 PM (4 days ago) Oct 15
to Bitcoin Development Mailing List
I think that "Bitcoin could need it in the future?" might be a good enough
reason not to do this.

Script pubkeys are the only variable-length transaction fields which can be
covered by input signatures, which might make them useful for future soft
forks. I can imagine confidential asset schemes or post-quantum coin recovery
schemes requiring large proofs in the outputs, where the validity of the proof
determined whether or not the transaction is valid, and thus require the
proofs to be in the outputs, and not just a hash commitment.

Greg Maxwell

unread,
Oct 15, 2025, 8:15:35 PM (4 days ago) Oct 15
to Casey Rodarmor, Bitcoin Development Mailing List
That concern is why the annex exists, I believe.  But taproot aside, that is a point.

But also given that there are essentially no violations and no reason to expect any I'm not sure the proposal is worth time relative to fixes of actual moderately serious DOS attack issues.

I guess a fair point is that given the ongoing progress towards consensus rules being the boundary of what gets mined, it would be nice to prevent big outputs that would bloat the utxo set.  OTOH any output over 10k is already pruned in implementations (as spending it is consensus invalid), so the gap here is really just between 520 and 10k.

But even if jumbo outputs were being created today I think they'd still be a less pressing issue than several of the other consensus cleanup issues.



--
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.

Brandon Black

unread,
Oct 17, 2025, 1:12:47 PM (2 days ago) Oct 17
to Bitcoin Development Mailing List
On 2025-10-16 (Thu) at 00:06:41 +0000, Greg Maxwell wrote:
> But also given that there are essentially no violations and no reason to
> expect any I'm not sure the proposal is worth time relative to fixes of
> actual moderately serious DOS attack issues.

I believe this limit would also stop most (all?) of PortlandHODL's
DoSblocks without having to make some of the other changes in GCC. I
think it's worthwhile to compare this approach to those proposed by
Antoine in solving these DoS vectors.

Best,

--Brandon

Antoine Poinsot

unread,
Oct 17, 2025, 2:45:44 PM (2 days ago) Oct 17
to Brandon Black, Bitcoin Development Mailing List
Hi,

This approach was discussed last year when evaluating the best way to mitigate DoS blocks in terms
of gains compared to confiscatory surface. Limiting the size of created scriptPubKeys is not a
sufficient mitigation on its own, and has a non-trivial confiscatory surface.

One of the goal of BIP54 is to address objections to Matt's earlier proposal, notably the (in my
opinion reasonable) confiscation concerns voiced by Russell O'Connor. Limiting the size of
scriptPubKeys would in this regard be moving in the opposite direction.

Various approaches of limiting the size of spent scriptPubKeys were discussed, in forms that would
mitigate the confiscatory surface, to adopt in addition to (what eventually became) the BIP54 sigops
limit. However i decided against including this additional measure in BIP54 because:
- of the inherent complexity of the discussed schemes, which would make it hard to reason about
constructing transactions spending legacy inputs, and equally hard to evaluate the reduction of
the confiscatory surface;
- more importantly, there is steep diminishing returns to piling on more mitigations. The BIP54
limit on its own prevents an externally-motivated attacker from *unevenly* stalling the network
for dozens of minutes, and a revenue-maximizing miner from regularly stalling its competitions
for dozens of seconds, at a minimized cost in confiscatory surface. Additional mitigations reduce
the worst case validation time by a smaller factor at a higher cost in terms of confiscatory
surface. It "feels right" to further reduce those numbers, but it's less clear what the tangible
gains would be.

Furthermore, it's always possible to get the biggest bang for our buck in a first step and going the
extra mile in a later, more controversial, soft fork. I previously floated the idea of a "cleanup
v2" in private discussions, and i think besides a reduction of the maximum scriptPubKey size it
should feature a consensus-enforced maximum transaction size for the reasons stated here:
https://delvingbitcoin.org/t/non-confiscatory-transaction-weight-limit/1732/8. I wouldn't hold my
breath on such a "cleanup v2", but it may be useful to have it documented somewhere.

I'm trying to not go into much details regarding which mitigations were considered in designing
BIP54, because they are tightly related to the design of various DoS blocks. But i'm always happy to
rehash the decisions made there and (re-)consider alternative approaches on the semi-private Delving
thread [0] dedicated to this purpose. Feel free to ping me to get access if i know you.

Best,
Antoine Poinsot

[0]: https://delvingbitcoin.org/t/worst-block-validation-time-inquiry/711
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/aPJ3w6bEoaye3WJ6%40console.

Antoine Riard

unread,
Oct 17, 2025, 9:20:53 PM (2 days ago) Oct 17
to Bitcoin Development Mailing List
Hi list,

Thanks to the annex covered by the signature, I don't see how the concern about limiting
the extensibility of bitcoin script with future (post-quantum) cryptographic schemes.
Previous proposal of the annex were deliberately designed with variable-length fields
to flexibly accomodate a wide range of things.

I believe there is one thing that has not been proposed to limit unpredictable utterance
of spams on the blockchain, namely congestion control of categories of outputs (e.g "fat"
scriptpubkeys). Let's say P a block period, T a type of scriptpubkey and L a limiting
threshold for the number of T occurences during the period P. Beyond the L threshold, any
additional T scriptpubkey is making the block invalid. Or alternatively, any additional
T generating / spending transaction must pay some weight penalty...

Congestion control, which of course comes with its lot of shenanigans, is not very a novel
idea as I believe it has been floated few times in the context of lightning to solve mass
closure, where channels out-priced at current feerate would have their safety timelocks scale
ups.

No need anymore to come to social consensus on what is quantitative "spam" or not. The blockchain
would automatically throttle out the block space spamming transaction. Qualitative spam it's another
question, for anyone who has ever read shannon's theory of communication only effective thing can
be to limit the size of data payload. But probably we're kickly back to a non-mathematically solvable
linguistical question again [0].

Anyway, in the sleeping pond of consensus fixes fishes, I'm more in favor of prioritizing
a timewarp fix and limiting dosy spends by old redeem scripts, rather than engaging in shooting
ourselves in the foot with ill-designed "spam" consensus mitigations.

[0] If you have a soul of logician, it would be an interesting demonstration to come with
to establish that we cannot come up with mathematically or cryptographically consensus means
to solve qualitative "spam", which in a very pure sense is a linguistical issue.

Best,
Antoine
OTS hash: 6cb50fe36ca0ec5cb9a88517dd4ce9bb50dd6ad1d2d6a640dd4a31d72f0e4999

Greg Maxwell

unread,
Oct 18, 2025, 5:25:18 AM (yesterday) Oct 18
to Antoine Riard, Bitcoin Development Mailing List
Limits on block construction that cross transactions make it harder to accurately estimate fees and greatly complicate optimal block construction--  the latter being important because smarter and more computer powered mining code generating higher profits is a pro centralization factor.

In terms of effectiveness the "spam" will just make itself indistinguishable from the most common transaction traffic from the perspective of such metrics--  and might well drive up "spam" levels because the higher embedding cost may make some of them use more transactions.  The competition for these buckets by other traffic could make it effectively a block size reduction even against very boring ordinary transactions.  ... which is probably not what most people want.

I think it's important to keep in mind that bitcoin fee levels even at 0.1s/vb are far beyond what other hosting services and other blockchains cost-- so anyone still embedding data in bitcoin *really* want to be there for some reason and aren't too fee sensitive or else they'd already be using something else... some are even in favor of higher costs since the high fees are what create the scarcity needed for their seigniorage.

But yeah I think your comments on priorities are correct.


PortlandHODL

unread,
Oct 18, 2025, 9:15:20 AM (yesterday) Oct 18
to Bitcoin Development Mailing List
Hey,

First, thank you to everyone who responded, and please continue to do so. There were many thought provoking responses and this did shift my perspective quite a bit from the original post, which in of itself was the goal to a degree.

I am currently only going to respond to all of the current concerns. Acks; though I like them will be ignored unless new discoveries are included.

Tl;dr (Portlands Perspective)
 - Confiscation is a problem because of presigned transactions
 - DoS mitigation could also occur through marking UTXOs as unspendable if > 520 bytes, this would preserve the proof of publication.
 - Timeout / Sunset logic is compelling
 - The (n) value of acceptable needed bytes is contentious with the lower suggested limit being 67
 - Congestion control is worth a look?

Next Step:
 - Deeper discussion at the individual level: Antoine Poinsot and GCC overlap?
 - Write an implementation.
 - Decide to pursue BIP

Responses

Andrew Poelstra:
> There is a risk of confiscation of coins which have pre-signed but
> unpublished transactions spending them to new outputs with large
> scriptPubKeys. Due to long-standing standardness rules, and the presence
> of P2SH (and now P2WSH) for well over a decade, I'm skeptical that any
> such transactions exist.

PortlandHODL: This is a risk that can be incurred and likely not possible to mitigate as there could be possible chains of transactions so even when recursively iterating over a chain there is a chance that a presigned breaks this rule. Every idea I have had from block redemption limits on prevouts seems to just be a coverage issue where you can make the confiscation less likely but not completely mitigated.

Second, there are already TXs that effectively have been confiscated at the policy level (P2SH Cleanstack violation) where the user can not find any miner with a policy to accept these into their mempool. (3 years)

/dev /fd0

>  so it would be great if this was restricted to OP_RETURN

PortlandHODL: I reject this completely as this would remove the UTXOset omission for the scriptPubkey and encourage miners to subvert the OP_RETURN restriction and instead just use another op_code, this also do not hit on some of the most important factors such as DoS mitigation and legacy script attack surface reduction.

Peter Todd
> NACK ...

PortlandHODL: You NACK'd for the same reasons that I stated in my OP, without including any additional context or reasoning.

jeremy

> I think that this type of rule is OK if we do it as a "sunsetting" restriction -- e.g. a soft fork active for the next N blocks (N = e.g. 2 years, 5 years, 10 years).

If action is taken, this is the most reasonable approach. Alleviating confiscatory concerns through deferral.

> You can argue against this example probably, but it is worth considering that absence of evidence of use is not evidence of absence of use and I myself feel that overall our understanding of Bitcoin transaction programming possibilities is still early.  If you don't like this example, I can give you others (probably).

Agreed and this also falls into the reasoning for deciding to utilize point 1 in your response. My thoughts on this would be along the lines of proof of publication as this change only has the effect of stripping away the executable portion of a script between 521 and 10_000 bytes or the published data portion if > 10_000 bytes which the same data could likely be published in chunked segments using outpoints.

Andrew Poelstra:

> Aside from proof-of-publication (i.e. data storage directly in the UTXO
> set) there is no usage of script which can't be equally (or better)
> accomplished by using a Segwit v0 or Taproot script.

This sums up the majority of future usecase concern

Anthony Towns:

> (If you restricted the change to only applying to scripts that used
non-push operators, that would probably still provide upgrade flexibility
while also preventing potential script abuses. But it wouldn't do anything
to prevent publishing data)

Could this not be done as segments in multiple outpoints using a coordination outpoint? I fail to see why publication proof must be in a single chunk. This does though however bring another alternative to mind, just making these outpoints unspendable but not invalidate the block through inclusion...

> As far as the "but contiguous data will be regulated more strictly"
argument goes; I don't think "your honour, my offensive content has
strings of 4d0802 every 520 bytes

Correct, this was never meant to resolve this issue.

Luke Dashjr:

> If we're going this route, we should just close all the gaps for the immediate future:

To put it nicely, this is completely beyond the scope of what is being proposed.

Guus Ellenkamp:

> If there are really so few OP_RETURN outputs more than 144 bytes, then
why increase the limit if that change is so controversial? It seems
people who want to use a larger OP_RETURN size do it anyway, even with
the current default limits.

Completely off topic and irrelevant

Greg Tonoski:
> Limiting the maximum size of the scriptPubKey of a transaction to 67 bytes.

This leave no room to deal with broken hashing algorithms and very little future upgradability for hooks. The rest of these points should be merged with Lukes response and either hijack my thread or start a new one with the increased scope, any approach I take will only be related to the ScriptPubkey

Keagan McClelland:

> Hard NACK on capping the witness size as that would effectively ban large scripts even in the P2SH wrapper which undermines Bitcoin's ability to be an effectively programmable money.

This has nothing to do with the witness size or even the P2SH wrapper

Casey Rodarmor:

> I think that "Bitcoin could need it in the future?" might be a good enough
reason not to do this.

> Script pubkeys are the only variable-length transaction fields which can be
covered by input signatures, which might make them useful for future soft
forks. I can imagine confidential asset schemes or post-quantum coin recovery
schemes requiring large proofs in the outputs, where the validity of the proof
determined whether or not the transaction is valid, and thus require the
proofs to be in the outputs, and not just a hash commitment.

Would the ability to publish the data alone be enough? Example make the output unspendable but allow for the existence of the bytes to be covered through the signature?


Antoine Poinsot:

> Limiting the size of created scriptPubKeys is not a sufficient mitigation on its own
I fail to see how this would not be sufficient? To DoS you need 2 things inputs with ScriptPubkey redemptions + heavy op_codes that require unique checks. Example DUPing stack element again and again doesn't work. This then leads to the next part is you could get up to unique complex operations with the current (n) limit included per input.


> One of the goal of BIP54 is to address objections to Matt's earlier proposal, notably the (in my
opinion reasonable) confiscation concerns voiced by Russell O'Connor. Limiting the size of
scriptPubKeys would in this regard be moving in the opposite direction.

Some notes is I would actually go as far as to say the confiscation risk is higher with the TX limit proposed in BIP54 as we actually have proof of redemption of TXs that break that rule and the input set to do this already exists on-chain no need to even wonder about the whole presigned. bb41a757f405890fb0f5856228e23b715702d714d59bf2b1feb70d8b2b4e3e08

Please let me know if I am incorrect on any of this.


> Furthermore, it's always possible to get the biggest bang for our buck in a first step

Agreed on bang for the buck regarding DoS.

My final point here would be that I would like to discuss more, and this is response is from the initial view of your response and could be incomplete or incorrect, This is just my in the moment response.

Antoine Riard:

> Anyway, in the sleeping pond of consensus fixes fishes, I'm more in favor of prioritizing
a timewarp fix and limiting dosy spends by old redeem scripts

The idea of congestion control is interesting, but this solution should significantly reduce the total DoS severity of known vectors. 

Greg Tonoski

unread,
Oct 18, 2025, 1:01:24 PM (21 hours ago) Oct 18
to Bitcoin Development Mailing List
> Limiting the maximum size of the scriptPubKey of a transaction to 67 bytes.

This leave no room to deal with broken hashing algorithms and very little future upgradability for hooks.
Can I ask for an example of such hooks for which room for "future upgradability" may be needed, please? I am not familiar with the subject and would like to learn more about it in order to evaluate the argument.

I disagree with the premise that larger maximum size of scriptPubKey is necessary for dealing with "broken hashing algorithms". Besides, I would suggest YAGNI principle.

/dev /fd0

unread,
Oct 18, 2025, 1:01:27 PM (21 hours ago) Oct 18
to PortlandHODL, Bitcoin Development Mailing List
Hi portlandhold,

> PortlandHODL: I reject this completely as this would remove the UTXOset omission for the scriptPubkey

Your proposed solution would affect the UTXO set negatively if someone is really motivated to use scriptpubkey for arbitrary data. They will use multiple outputs as people do with [DNS records][0].

> and encourage miners to subvert the OP_RETURN restriction and instead just use another op_code

What would motivate users to follow this approach, considering that storing data in the witness is cheaper?


/dev/fd0
floppy disk guy


Reply all
Reply to author
Forward
0 new messages