During execution of the script i.e. ScriptSig + ScriptPub , the last step is the verification of the Signature against the public key provided by the recipient. How does this work and what is the significance of verifying two entities which belong to the same user?
During Bitcoin Script execution, what is the significance of the signature verification in the stack?
How does this work
Bitcoin uses the Elliptic Curve Digital Signature Algorithm. The algorithm is described on Wikipedia (linked). Bitcoin specifically uses the secp256k1 elliptic curve.
what is the significance of verifying two entities which belong to the same user?
There are not two entities.
The signature proves that the owner of the private key which corresponds to the public key created the signature over a given message. In the case of Bitcoin, the message is the hash of the transaction (excluding the signatures themselves because they don't exist yet). This ensures that the person spending the output is allowed to do so and ensures the integrity of the spending transaction itself.
Okay but according to my understanding, both the signature and the public key are provided by the same address. So how can it be fool proof? Feb 11, 2018 at 18:44
The scriptPubKey of the output that is being spent specifies that the public key must hash to a hash specified by the scriptPubKey.– Andrew Chow ♦Feb 11, 2018 at 18:49
Can you please elaborate? I am a beginner in Blockchain and Bitcoin. Feb 11, 2018 at 18:57
Each input must reference the output from a previous transaction that it spends from. That output contains an output script which is called the scriptPubKey. That scriptPubKey is combined with the input script, the scriptSig, and run as a program. The scriptPubKey typically specifies the hash of the public key that is allowed to spend the transaction output. The person spending that output has no control over the scriptPubKey; it is provided by the person creating the output.– Andrew Chow ♦Feb 11, 2018 at 19:00
A similar message, and a link to Andreas’ book, cause explaining here all the stuff would waste the space... bitcoin.stackexchange.com/questions/69062/… Feb 11, 2018 at 19:04