The ScriptSig is also called the unlocking script because it unlocks the transaction for Alice.

The ScriptPubKey is called the locking script because it relocks it with Bob’s key.

The two scripts work together to guarantee that Alice has the right to transact the value and that Bob, and only Bob, will now have control of it.

ScriptSig is processed first and placed on a stack, and then ScriptPubKey uses the value and carries out a series of processes, including Bob’s public key, to create the locking value. Only Bob’s subsequent ScriptSig will agree with the value in the transaction, enabling him to control it.

The calculations carried out in ScriptPubKey are quite simple and are based on an old programming language called Forth. An instruction is put on the stack, resulting in a value, and then a new process can be carried out, and so on.

Here are some examples:

  • OP_DUP duplicates the value on the stack.
  • OP_CHECKSIG checks the signature on the stack.
  • OP_HASH160 hashes the value on the stack.

The example is given really describes a P2PKH or Pay-To-Public-Key-Hash transaction. Although it can have multiple inputs and outputs, it only requires one signature. A multisignature or P2SH, Pay-To-Script-Hash, is slightly different in that, for example, it may have multiple signatures required to unlock or lock the transaction.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment