1

I'm trying to figure out the limitations that scripts have regarding their size, limits that would make a script invalid (ignoring standardness). According to this question and also these lines of code in bitcoin core's source code 1 2 3 it appears that the following rules are in place:

Maximum script size = 10,000
Maximum data size to be pushed to the stack = 520

To test these rules I made a bunch of transactions on TestNet, all of which breaking some rule and were included in blocks (all sent from n3eynMTEiGgPTuoKPApnRjE9pAuaAk3gkB)? Example:
Tx ID: 88bac1e84c235aa0418345bf430fb43b336875974b6e87dc958de196f9222c35
PubkeyScript length=0xfd1527=10,005 script=4d11275b2c...394e75orPush_10001_byte<5b2c...394e> OP_DROP
As you can see the length of the script is already 10,005 > 10,000 and the first data push is 10,001 > 520. In other words I broke both rules.
Also as far as I know the "consensus" rules are exactly the same on TestNet (with one exception: difficulty adjustment), is that correct? So how is this transactions valid?

Coding Enthusiast
  • 1,438
  • 5
  • 23

1 Answers1

3

Those consensus rules are indeed the same for testnet and mainnet.

However, they do only apply when scripts are executed. So you have to create an input trying to spend it to test this.

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308