Reading Assignment: Script

Answers:

  1. OP_OP_CHECKSIGVERIFY is executed after OP_OP_CHECKSIG, also OP_OP_CHECKSIG it has a true / false outcome by using a valid signature for hashing and public key.

  2. push: OP_DUP, OP_2DUP, OP_OVER.

pop: OP_NIP, OP_2DROP, OP_DROP.

  1. 0xae
2 Likes
  1. OP_CHECKSIGVERIFY does the same thing as OP_CHECKSIG but does one more function and verifies the transaction. It allows the transaction to go through or not.
  2. OP_DROP
  3. 0xae
1 Like
  1. OP_CHECKSIG will return a true or false to the top of the stack and OP_CHECKSIGVERIFY calls afterward OP_VERIFY which remove the top stack if the value is false
  2. OP_DROP
  3. 0xae
1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?

OP_CHECKSIGVERIFY do the same as OP_CHECKSIG, but also execute OP_VERIFY afterward.


  1. What is the “Pop” functions called in Script? (It is not called OP_POP)

OP_DROP. Pop function take away one element on the top of the stack, remove the top element.


  1. What is the hexadecimal OP Code for OP_CHECKMULTISIG?

0xae.


1 Like
  1. They are pretty much the same, the only difference is that OP-CHECKSIGVERIFY the transaction will be marked as invalid if the top stack value is not true.
  2. OP_DROP
  3. 0xae
1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?

OP_CHECKSIGVERIFY Is the same as OP_CHECKSIG, but OP_VERIFY is executed afterward. OP_VERIFY marks the transaction as invalid if top stack value is not true. The top stack value is removed.

  1. What is the “Pop” functions called in Script? (It is not called OP_POP)

OP_DROP

  1. What is the hexadecimal OP Code for OP_CHECKMULTISIG?

0xae

1 Like
  1. OP_CHECKSIGVERIFY is the same as OP_CHECKSIG but OP_VERIFY is executed afterward. OP_VERIFY marks the transaction as invalid if the top stack value is not true. The top stack value is removed.

  2. OP_DROP removes the top stack item.

  3. The hexadecimal OP code for OP_CHECKMULTISIG is 0xae.

1 Like
  1. op_checksig checks the tx hash is valid and returns 1 if valid, 0 otherwise. op_checksigverify combines op_checksig and op_verify, which then checks to see if the top stack value is valid, if not (0) it is removed.

  2. op_drop removes the top stack item, op_2drop removes the top two stack items, op_nip removes second top stack item.

  3. 0xae

1 Like
  1. OP_CHECKSIG and OP_CHECKSIGVERIFY are the same except that OP_CHECKSIGVERIFY executes OP_VERIFY afterwards.

  2. OP_DROP is the equivalent of “POP”

  3. The Answer is 0xae .

1 Like

1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?

OP_CHECKSIG checks if the signature is valid (1) or invalid (0) for the
public key and hash generated using the entire transaction’s outputs, inputs, and script.

OP_CHECKSIGVERIFY does the same thing then calls OP_VERIFY which checks the top stack value. If the value is false (0) it marks it as invalid and then removes it.

2. What is the “Pop” functions called in Script? (It is not called OP_POP)

OP_DROP is used to implement “Pop” functions in Script.

3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?

0xae is the hexadecimal OP code for OP_CHECKMULTISIG

2 Likes

1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
OP_OP_CHECKSIGVERIFY does the same as OP_OP_CHECKSIG, but OP_VERIFY is executed afterward.
2. What is the “Pop” functions called in Script? (It is not called OP_POP)
OP_DROP
3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
0xae

1 Like
  1. The difference is that OP_CHECKSIG only hashes the outputs, inputs, and script. The signature used by OP_CHECKSIG must be a valid signature for the hash and public key. If it is valid, 1 (true) is returned, if not valid, 0 (false) is returned. With OP_CHECKSIGVERIFY the same process happens but it also marks TX’s invalid if the top stack value is not true (0) and then removes it from the stack.

OP_CHECKSIG - The entire transaction’s outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise
OP_CHECKSIGVERIFY - Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.
OP_VERIFY - Marks transaction as invalid if top stack value is not true. The top stack value is removed.

  1. OP_IF (if the top value is not false), OP_NOTIF (if the top value is false), OP_VERIFY (if the top stack value is not true), OP_CHECKMULTISIG (Due to a bug, one extra unused value is removed from the stack), OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG, OP_TOALTSTACK, OP_FROMALTSTACK, OP_DROP, OP_NIP, OP_2DROP. In all of these commands the top stack item is removed.

  2. Hexidecimal Opcode is Oxae. Standard Opcode is 174

1 Like
  1. What is the practical difference between OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    OP_CHECKSIG gets as input (in stack depth order) the public key used to sign the transaction and
    the signature of the transaction. It returns (1) if the transaction is valid and (0) otherwise. This value is input at the top of the stack. OP_CHECKSIGVERIFY takes advantage of the boolean value resting on top of the stack and automatically runs OP_VERIFY on the output of OP_CHECKSIG, in order to fail the script if not valid.
  2. What is the “Pop” functions called in Script? (It is not called OP_POP)
    OP_DROP : Removes the top stack item.
  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    0xae
1 Like
  1. After a valid signature is used by OP_CHECKSIG and the transaction’s
    inputs, outputs and scripts are hashed, OP_CHECKSIGVERIFY, is then executed.
    Other than that the two are the same.

  2. OP_DROP : Removes the top stack item.

  3. Oxae

1 Like

OP_CHECKSIGVERIFY executes OP_VERIFY after :slight_smile:

  1. OP_CHECKSIG checks if the signature for a hash and public key are valid and returns ture or false.
    OP_CHECKSIGVERIFY does the same but adds an additional OP_VERIFY operation afterwards, marking a transaction as invalid if the signature is not valid.

  2. OP_DROP

  3. 0xae

1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    OP_OP_CHECKSIGVERIFY is same as OP_OP_CHECKSIG but OP_VERIFY is applied afterwards

  2. What is the “Pop” functions called in Script? (It is not called OP_POP)
    OP_DROP

  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    0xae

1 Like

A.1. OP_CHECKSIG is script operation code used to verify that the signature for a transaction (tx) input is valid. OP_CHECKSIG expects two values to be on the stack. These are the public key and the signature of the script.

A.2. In Script the pop function is called OP_DROP.

A.3. The hexadecimal OP Code for OP_CHECKMULTISIG is 0xae.

1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    First of all, the two operations does pretty much the same thing: to check if a transaction is valid by taking as inputs the public key and script signature (which is basically a hash). While Op_checksig return true or false, the op_checksigverify return INVALID if “check sig” test didn’t pass and clears the stack. I believe the practical purpose of Op_checksigverify is reject an invalid transaction right away.

I think the other practical reason of Op_checksigverify over Op_Checksig is that the later exposes the entire public key, which can expose the sender to a less protection.

  1. What is the “Pop” functions called in Script? (It is not called OP_POP)
    OP_Drop

  2. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    0xae

2 Likes
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    Answer:
    OP_CHECKSIG and OP_CHECKSIGVERIFY are the same but the difference is that VERIFY is call with the later afterward, which Marks transaction as invalid if top stack value is not true. The top stack value is removed.
  2. What is the “Pop” functions called in Script? (It is not called OP_POP)
    Answer:
    It popped out data off the stack starting from the last push once.
  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    Answer:
    0xae
1 Like