0

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?

2

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.

| improve this answer | |
  • So practically this means the only limit on PubkeyScript is block size, right? – Coding Enthusiast Mar 6 at 5:45
  • That is effectively the only consensus limit on outputs, I believe, indeed. – Pieter Wuille Mar 6 at 5:47
  • This is my understanding too. – Anonymous Mar 6 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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