Can scriptPubKey be empty in Bitcoin transactions and how would such outputs be spent?
Question
I'm trying to understand Bitcoin's consensus rules regarding empty scriptPubKey
fields in transaction outputs.
I've found conflicting information:
- Some AI sources claim that empty
scriptPubKey
field is not allowed by consensus rules - However, I found this older Stack Exchange answer from ~10 years ago saying the opposite
I have two questions:
- Can a Bitcoin transaction output have a completely empty
scriptPubKey
(0 bytes) and still be considered valid by current consensus rules? - If such outputs are valid, how can they be spent? What would
scriptSig
look like? Can it be just<3>
and that's it (since top level stack element would be non-zero value; it's3
)?
Answer 1
- Can a Bitcoin transaction output have a completely empty
scriptPubKey
(0 bytes) and still be considered valid by current consensus rules?
Yes, but not by the current standardness rules in Bitcoin Core.
- If such outputs are valid, how can they be spent? What would
scriptSig
look like? Can it be just<3>
and that's it (since top level stack element would be non-zero value; it's3
)?
Indeed. But again, such a spend will not be valid by standardness rules.
Note that just because an output is valid, does not mean it can be spent. E.g., a scriptPubKey
of <0>
would be valid (as in by consensus it is allowed to appear in a transaction output), but there is no way to spend it.