Let's say I want to encode the text of the King James version of the Bible into the block chain, one piece at a time (replace this with any zany idea to consume copious quantities of block space). OP_RETURN is impractical because I can only work with 80-byte chunks.

I notice that SegWit allows much more data to be stored - up to 3 MB/block - in witness data.

Clearly, I can't use a V0 witness program because my witness data must take the form

<signature> <pubkey>

However, I believe I can use a V1 witness program. Scripts with that version won't be supported immediately after SegWit deployment, but I notice this in BIP-141:

If the version byte is 1 to 16, no further interpretation of the witness program or witness stack happens, and there is no size restriction for the witness stack. These versions are reserved for future extensions.

So here's my plan. I'm going to create an output script of the form:

<0x01> <0x0000>

This is a V1 witness program. According to BIP-141, the witness program is not to be interpreted, and the subsequent witness stack will have no size restriction.

Then I'm going to spend that output with a witness transaction input. The witness of my transaction encodes a thousand bytes of text.

When I publish this spending transaction, it will be propagated by nodes. They can't reject it as invalid because that would break forward compatibility when V1 scripts are introduced. BIP-141 says nothing about whether or not such transactions should be relayed (nor does BIP-144), so I assume they will be.

As long as I pay a sufficiently high fee, my transaction should eventually be mined. I even get a 75% discount over using OP_RETURN because my text is encoded in the witness.

And there's nothing the protocol will do to stop me. Or is there?

Edit: to make things simple, assume SegWit has been widely-deployed and that most nodes understand V0 witness programs. Clearly, non-SegWit nodes will not relay a witness transaction because it will be considered non-standard. I'm interested in the behavior of SegWit nodes.

  • How did this age after SegWit adoption?
    – CSᵠ
    Nov 8, 2022 at 10:41
  • @CSᵠ see ordinals... Feb 26 at 18:48

1 Answer 1


Your transaction, although not invalid, is non-standard. Since it is non-standard, it will not be propagated and will be rejected for being non-standard. However this does not mean that it cannot be included in a block; it can. It only requires that the miner and all of the nodes between you and that miner must be running some software that accepts and relays non-standard transactions. However not many nodes actually do, so you may have a hard time getting good propagation of your transaction.

  • Non-standard for a segwit node or a non-segwit node? If segwit nodes consider such a transaction non-standard, where is that stated in the documentation? Jun 23, 2017 at 20:32
  • Segwit is constructed in such a way that every SegWit spend is non-standard to non-segwit nodes. Jun 23, 2017 at 20:36
  • @PieterWuille, of course. But how would a segwit node that only understands V0 witness programs respond to my attack? Jun 23, 2017 at 21:08
  • 1
    Future witness versions are non-standard by policy in Bitcoin Core for precisely the reason you point out. This is generic: all constructions that exist which are intended for future extensibility are treated as non-standard (for example, also the OP_NOPx opcodes). Jun 23, 2017 at 21:10
  • 1
    @RichApodaca standardness for outputs is defined by this function here: github.com/bitcoin/bitcoin/blob/master/src/policy/…. The solver function that is called will end up at this if block: github.com/bitcoin/bitcoin/blob/master/src/script/…. From that code, you can see that any non v0 witness output will return false in the solver which then causes IsStandard to return false too, indicating that non v0 witness outputs are non-standard. The same happens here for inputs github.com/bitcoin/bitcoin/blob/master/src/policy/…
    – Ava Chow
    Jun 23, 2017 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.