Reading Assignment: Script

  1. OP_CHECKSIGVERIFY is the same as OP_CHECKSIG, but OP_VERIFY is executed afterward.

In a practical sense, OP_CHECKSIG can only output 1 or 0 (true or false), if the signature used for the hash (from the entire TX, inputs, outputs, script) and public key is valid.

OP_CHECKSIGVERIFY will only output ‘fail’, otherwise there is no output.

  1. In Script, the Pop function is called OP_DROP.

  2. Hexadecimal for OP_CHECHMULTISIG is 0xae

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

Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.

  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

1 Like

Script :lock_with_ink_pen:

  1. What is the practical difference between OP_CHECKSIG and OP_CHECKSIGVERIFY?
    OP_CHECKSIGVERIFY will execute OP_VERIFY on the result that ends up on top of the stack after OP_CHECKSIG has been executed. It’s basically the verification function bolted onto the preceding signature check.

  2. What is the “Pop” functions called in Script?
    In order to pop something from the top of the stack we’d use OP_DROP.

  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    The decimal Opcode 174 for OP_CHECKMULTISIG corresponds to hexadecimal 0xae if we calculate it as follows:
    (AE)₁₆ = (10 × 16¹) + (14 × 16⁰) = (174)₁₀

1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    OP_CHECKSIG is the same as OP_CHECKSIGVERIFY, except that OP_CHECKSIGVERIFY executes OP_VERIFY afterwards.

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

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

1 Like

What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?

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.

Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.

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

What is the hexadecimal OP Code for OP_CHECKMULTISIG?
0xae

1 Like
  1. OP_CHECKSIGVERIFY is the same as OP_CHECKSIG but executes OP_VERIFY afterwards

  2. OP_DROP

  3. 0xae

1 Like
  1. OP_OP_CHECKSIG checks a transaction and returns a boolean at the top of stack.
    OP_OP_CHECKSIGVERIFY takes the boolean result, it true then returns Null, otherwise marks as invalid.

  2. OP_DROP

  3. OxAE

1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    OP_CHECKSIG takes sig and pubkey, hashes the transaction, checks if the signature is valid for the hash and the public key, returns true or false. OP_CHECKSIGVERIFY does the same thing but then runs OP_VERIFY. OP_VERIFY marks the transaction as invalid if the top stack value is not true.
  2. What is the “Pop” functions called in Script? (It is not called OP_POP)
    It’s called OP_DROP.
  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    It is 0xae.
1 Like
  1. What is the practical difference between OP_CHECKSIG and OP_CHECKSIGVERIFY?
    OP_CHECKSIGVERIFY = OP_CHECKSIG OP_VERIFY
    OP_CHECKSIG is used to verify that the signature for a tx input is valid, expects two values to be on the stack. These 2 values are in order of stack depth, the public key and the signature of the script.
    OP_VERIFY Marks transaction as invalid if top stack value is not true. The top stack value is removed.
    Practically:
    a. if signature is valid, OP_CHECKSIG retuns True, OP_CHECKSIGVERIFY retuns nothing -> tx is OK
    b. if signature is not valid, OP_CHECKSIG returns false, OP_CHECKSIGVERIFY tx fails -> public key
    & signature are removed from stack
  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

What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
I understood that the result for first one OP_OP_CHECKSIG is true or false( depending if the signature is valid or not )
For the latest OP_OP_CHECKSIGVERIFY if the signature is not valid the output fail

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

What is the hexadecimal OP Code for OP_CHECKMULTISIG?
0xae

1 Like
  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    As I understood, OP_OP_CHECKSIG is called before the transaction is executed, while OP_OP_CHECKSIGVERIFY is called at end as confirmation. Please correct me if I am not true.

  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

They are the same but OP_OP_CHECKSIGVERIFY executes OP_VERIFY at the end verifying if OP_CHECKSIG returned a valid signature. :slight_smile:

1 Like
  1. What is the practical difference between OP_CHECKSIG and OP_CHECKSIGVERIFY?
    The checksig command wont make the transaction a failure. It is just a check that returns a boolean. ChecksigVerify triggers a transaction failure if case the checksig returns false.

  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

2 Likes

First, you all are not explaining anything … nowhere does it state what “marking a stack as invalid” actually does … “what does that look like?” … Also, nowhere does it describe the difference in for example OP_CHECKSIGVERIFY and OP_CHECKSIG OP_VERIFY … or if there is a difference. Why just add the verify at the end of the last opperation instead of a OP_ in between. Is there a difference. Is this just shortening code for ease of creating code?
But I digress.
Question 1: What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?

OP_0 or OP_FALSE reports an empty value to the stack
OP_1 ot OP_TRUE The number 1 is pushed to the stack
so:
OP_OP_ would mean the OP_ reporting a 0 or 1 would return one of the above items when the initial OP performs its duty

OP_CHECKSIG returns a 1 or 0 depending on if the signature is correct or not.
(Note: 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 returns
Hmmm … OP_VERIFY -
Marks transaction as invalid if top stack value is not true. The top stack value is removed. What does mark invalid mean or “look like”???

Well anyway … so OP_OP_CHECKSIGVERIFY returns a 1 or returns a zero with the stack marked as invalid

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

OP_DROP … Removes the top stack item.

Question 3: What is the hexadecimal OP Code for OP_CHECKMULTISIG?

0xae

2 Likes

How odes one know this? How do we know that the public key and signature are removed from the stack?

1 Like

OP_VERIFY is usually executed at the end of script execution. It simply marks the script as being completed as valid or invalid and if the transaction can be executed.

OP_CHECKSIGVERIFY is basically the short hand version because they often come one after the other. :slight_smile:

Maybe the Script Wiki can offer some light on this.

1 Like
  1. Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.

2.OP_DROP

  1. 0xae
2 Likes

What is the practical difference between OP_CHECKSIG and OP_CHECKSIGVERIFY?
OP_CHECKSIG will pop the public key and signature off the stack and verify the signature is valid for the generated hash (generated from transactions inputs and outputs) and the given public key. It will then push the result on to the stack, 1 if it is valid, 0 if not.
OP_CHECKSIGVERIFY will do the same but then pop the result off the stack and based on whether it is a 1 or 0, mark the transaction as valid or invalid respectively.
What is the “Pop” functions called in Script? (It is not called OP_POP)
OP_DROP
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? — OP_CHECKSIGVERIFY executes OP_VERIFY after. OP_CHECKSIG returns 1 is signature is valid for hash and public key but OP_CHECKSIGVERIFY simply returns nothing.
  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
2 Likes

1.)

OP_CHECKSIG returns a valid signature.

OP_CHECKSIGVERIFY returns a valid signature and executes OP_VERIFY at the end.

2.)

OP_DROP - Removes the top stack item.

3.)

Opcode=174 Hex= 0xae

1 Like