Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on March 23, 2019, 06:29:47 AM



Title: Is emtpy ScriptPubKey nonstandard or illegal?
Post by: Coding Enthusiast on March 23, 2019, 06:29:47 AM
If illegal, since when?

(If any readers are curious, here is an example: 8ec3e3dd39150798d71c61ffb7cc18ade6f2a2958378e18b7a98eefb709e7322 spent by f21b099d67070a7639d384f30e9b139bab58c27e47368a2d8152f05c14e187b7 which is the smallest tx record)


Title: Re: Is emtpy ScriptPubKey nonstandard or illegal?
Post by: Pmalek on March 23, 2019, 08:27:03 AM
I am not sure if this will help you any further but give it a try.
Have a look at this work by Peter Todd, RFC: empty scriptPubKeys and OP_RETURN for marking unspendable txouts
https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-February/002159.html

I also found an older thread from 2015.
https://bitcointalk.org/index.php?topic=1038794.msg11208171#msg11208171



Title: Re: Is emtpy ScriptPubKey nonstandard or illegal?
Post by: darosior on March 23, 2019, 02:14:22 PM
If illegal, since when?

(If any readers are curious, here is an example: 8ec3e3dd39150798d71c61ffb7cc18ade6f2a2958378e18b7a98eefb709e7322 spent by f21b099d67070a7639d384f30e9b139bab58c27e47368a2d8152f05c14e187b7 which is the smallest tx record)
A script has to be standard or the transaction won't be accepted, this check is done with the isStandard() boolean function (https://github.com/bitcoin/bitcoin/blob/bccb4d29a8080bf1ecda1fc235415a11d903a680/src/policy/policy.cpp#L57) which will return false if the Solver function (https://github.com/bitcoin/bitcoin/blob/bccb4d29a8080bf1ecda1fc235415a11d903a680/src/script/standard.cpp#L90) returns `TX_NONSTANDARD`.
The `Solver()` function will return `TX_NONSTANDARD` if the script is not P2SH, or valid WITNESS, or OP_RETURN, or P2PK, or P2PKH. None of them can be empty, thus a transaction with an output containing an empty scriptPubkey will be non standard and thus not accepted (/illegal).

EDIT : To answer the question in the title, "nonstandard or illegal ?", this is the same : only standard scripts are legal.


Title: Re: Is emtpy ScriptPubKey nonstandard or illegal?
Post by: Coding Enthusiast on March 23, 2019, 03:43:26 PM
EDIT : To answer the question in the title, "nonstandard or illegal ?", this is the same : only standard scripts are legal.

Maybe the term "illegal" was an ambiguous term, my English was not helping me find a better word!
By "illegal" I mea whether the transaction containing an empty script would be invalid in a block. As you can see from the transaction I posted in OP it was perfectly possible in 2015 to have such transactions, I want to know if anything has changed.

BTW nonstandard means bitcoin-core nodes automatically reject these transactions and won't relay them. They are not breaking any rules though which is why they can exist in blocks.


Title: Re: Is emtpy ScriptPubKey nonstandard or illegal?
Post by: achow101 on March 23, 2019, 04:38:45 PM
It is non-standard but still valid. No consensus changes have been made regarding empty scriptPubKeys.