Title: Help with understanding Bitcoin script. Post by: evanlinjin on August 30, 2020, 08:01:01 AM I'm going through the book Mastering Bitcoin, and I have a query regarding the section on "Using Flow Control in Scripts".
So, there is an example of a redeem script as follows: Code: IF I'm wondering why it is structured in this manner, instead of the following: Code: IF Would the latter work? And if so, would it be the better version as it saves space by one opcode? Thank you all in advance. Title: Re: Help with understanding Bitcoin script. Post by: pooya87 on August 30, 2020, 09:06:37 AM yes the second one works and essentially does the same thing as the first one but in a more efficient way. this example is probably like this to show how OP_IFs work otherwise there is a better way of defining this particular script which is using multi-sig.
Code: 1 <Alice's PK> <Bob's PK> 2 CHECMULTIKSIG usually the conditional scripts like this are more complex and each expression could contain multiple pubkeys with a multi-sig OP or sometimes locktimes or other complications which has to be defined like the first script. examples: Code: IF Code: IF Title: Re: Help with understanding Bitcoin script. Post by: evanlinjin on August 30, 2020, 10:19:08 AM Awesome! Thank you for your help with clarifying :)
|