Author

Topic: Help with understanding Bitcoin script. (Read 169 times)

brand new
Activity: 0
Merit: 0
September 21, 2020, 01:44:47 AM
#4
As of late, for boosting little scope organizations in the nation, the Government of India has started the Udyog Aadhaar Registration process. Prior, in the event that you wished to begin msme registration online a business and get SSI enlistment or MSME enrollment, you expected to experience a great deal of administrative work.
newbie
Activity: 2
Merit: 0
August 30, 2020, 06:19:08 AM
#3
Awesome! Thank you for your help with clarifying Smiley
legendary
Activity: 3472
Merit: 10611
August 30, 2020, 05:06:37 AM
#2
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   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
  CHECMULTIKSIG
ELSE
  CHECKSIG
ENDIF
Code:
IF
  CheckLocktimeVerify DROP CHECKSIG
ELSE
  2 2 CHECKMULTISIG
ENDIF
newbie
Activity: 2
Merit: 0
August 30, 2020, 04:01:01 AM
#1
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
  CHECKSIG
ELSE
  CHECKSIG
ENDIF

I'm wondering why it is structured in this manner, instead of the following:

Code:
IF
 
ELSE
 
ENDIF
CHECKSIG

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.
Jump to: