<blockquote>
  <p>How does this work</p>
</blockquote>

<p>Bitcoin uses the <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" rel="nofollow noreferrer">Elliptic Curve Digital Signature Algorithm</a>. The algorithm is described on Wikipedia (linked). Bitcoin specifically uses the secp256k1 elliptic curve.</p>

<blockquote>
  <p>what is the significance of verifying two entities which belong to the same user?</p>
</blockquote>

<p>There are not two entities.</p>

<p>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.</p>

CC BY-SA 3.0
2018-02-11T18:44:26.090Z
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?
Varad Bhatnagar
CC BY-SA 3.0
2018-02-11T18:49:29.090Z
The scriptPubKey of the output that is being spent specifies that the public key must hash to a hash specified by the scriptPubKey.
Ava Chow
CC BY-SA 3.0
2018-02-11T18:57:35.017Z
Can you please elaborate? I am a beginner in Blockchain and Bitcoin.
Varad Bhatnagar
CC BY-SA 3.0
2018-02-11T19:00:01.843Z
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.
Ava Chow
CC BY-SA 3.0
2018-02-11T19:04:52.937Z
A similar message, and a link to Andreas’ book, cause explaining here all the stuff would waste the space... https://bitcoin.stackexchange.com/questions/69062/why-does-bitcoin-uses-a-script-language/69077#69077
pebwindkraft
CC BY-SA 3.0
2018-02-11T18:26:53.493Z
2018-02-11T18:26:53.493Z
Ava Chow
<p>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?</p>

<script><public-key><signature>
During Bitcoin Script execution, what is the significance of the signature verification in the stack?
Varad Bhatnagar
# During Bitcoin Script execution, what is the significance of the signature verification in the stack?

(Asked by: username_0 on 2018-02-11)

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?

**Tags:** script, public-key, signature


---

## 1 answers

### Answer by username_1 on 2018-02-11. Score: 1 | Accepted answer

> How does this work

Bitcoin uses the [Elliptic Curve Digital Signature Algorithm](https://en.wikipedia.org/wiki/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.

> **Comments:**
> **username_0**: 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?  
> **username_1**: The scriptPubKey of the output that is being spent specifies that the public key must hash to a hash specified by the scriptPubKey.  
> **username_0**: Can you please elaborate? I am a beginner in Blockchain and Bitcoin.  
> **username_1**: 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.  
> **username_2**: A similar message, and a link to Andreas’ book, cause explaining here all the stuff would waste the space... https://bitcoin.stackexchange.com/questions/69062/why-does-bitcoin-uses-a-script-language/69077#69077  

---

