Should bitcoin transactions with invalid output scripts be invalid? #320

issue roconnor opened this issue on June 16, 2011
  1. roconnor commented at 3:08 PM on June 16, 2011: none

    At the moment, bitcoin does not verify that the outscripts of transactions are syntactically valid. Thus it is possible to create a transaction with junk in it's outscripts and get it into the block chain. No one could spend such coins (at least until the opcodes change). The question is, should such garbage transactions simply be rejected out of hand instead?

    I believe the main blockchain has no such garbage outscripts in it yet, so this change could be effected now without harming the chain.

  2. gavinandresen commented at 4:09 PM on June 16, 2011: contributor

    One person's garbage is another person's gold.

    And the blockchain DOES have garbage transactions in it-- see block 71036. Those garbage transactions partly insipired the change so that non-standard transactions ARE rejected by clients and mainline miners.

    I'm going to close this; if you have a specific proposal, please discuss it on the forums.

  3. gavinandresen closed this on Jun 16, 2011

  4. roconnor commented at 4:23 PM on June 16, 2011: none

    You are wrong. All the scripts in Block 71036 are syntactically valid.

  5. sipa commented at 4:31 PM on June 16, 2011: member

    @roconnor is talking about syntactic validity, not about whether the script is a) standard or b) evaluates to true for a particular/possible input. For example if it'd contain unknown opcodes, or opcodes that require additional databytes at the end of the output script.

  6. gavinandresen reopened this on Jun 16, 2011

  7. gavinandresen commented at 4:46 PM on June 16, 2011: contributor

    Benefit of allowing anything is it will make upgrading easier.

    I don't see any harm in leaving the TxOuts unparsed until they're spent. I suppose you could arge that syntactically incorrect garbage could bloat the block chain, but it is almost as easy to create syntactically CORRECT garbage to bloat up the chain.

  8. roconnor closed this on Jun 16, 2011

  9. roconnor commented at 11:31 PM on June 16, 2011: none

    As long as you understand, I also don't see any harm either. I'll close.

  10. roconnor commented at 10:49 PM on June 29, 2011: none

    Upon further inspection, I think that the TxOut scripts are parsed before being included in the block chain. Because of the way the TxOut structure is serialized the length of the script is included in the serialization. The length of the script is pretty much impossible to compute without parsing the script. (I had erroneously thought it was the length in bytes of the serialized script that was put into the serialized transaction, but it is the length of the script.)

  11. roconnor commented at 4:39 PM on July 3, 2011: none

    Ah no, I was right origianlly, TxOut scripts are unparsed.

  12. sipa referenced this in commit 9177950c74 on Oct 21, 2015
  13. sipa referenced this in commit f4787d1caf on Oct 21, 2015
  14. sipa referenced this in commit 6557a8cd46 on Oct 26, 2015
  15. sipa referenced this in commit ea06490d14 on Oct 27, 2015
  16. sipa referenced this in commit 003bb87153 on Nov 5, 2015
  17. sipa referenced this in commit bfd83199c3 on Nov 11, 2015
  18. sipa referenced this in commit b437ea7ec9 on Nov 12, 2015
  19. sipa referenced this in commit 1d84107924 on Nov 12, 2015
  20. jtimon referenced this in commit 91ee21c024 on Mar 11, 2016
  21. rebroad referenced this in commit 40ead34fbe on Dec 7, 2016
  22. deadalnix referenced this in commit 52fd03f1ba on Jan 19, 2017
  23. deadalnix referenced this in commit 575edadd55 on Mar 1, 2017
  24. deadalnix referenced this in commit 0e8029227d on Mar 1, 2017
  25. deadalnix referenced this in commit 8fe07f235d on Mar 1, 2017
  26. classesjack referenced this in commit 9700286c34 on Jan 2, 2018
  27. cirosantilli commented at 7:44 PM on January 14, 2021: none

    Fun fact, the outputs of this transaction seem to be the first syntactically incorrect scripts of the blockchain: https://blockchain.info/tx/ebc9fa1196a59e192352d76c0f6e73167046b9d37b8302b6bb6968dfd279b767?format=json made in 2013, e.g. "script":"01". It's fun to see people throw away 3000 dollars for run.

  28. MarcoFalke locked this on Jan 14, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 09:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me