<pre><code>static bool verify ( const QByteArray&amp; dgst, const QByteArray&amp; pub, const QByteArray&amp; sig )
{
  return 0 &lt; ECDSA_verify ( 0, (const quint8*)dgst.constData ( ), 32,
    (const quint8*)sig.constData ( ), sig.size ( ), EC_KEY_pub_key ( pub ) );
}
</code></pre>

CC BY-SA 3.0
2015-02-23T13:46:11.170Z
2015-02-23T13:46:11.170Z
amaclin
<p>Simple, the sender shows the pubkey when spending from whatever address the bitcoins are in. As part of the verification, the receiver (actually, every node in the network), can verify that the pubkey hashes to the address given and then and only then verifies the signature.</p>

CC BY-SA 3.0
2015-02-22T21:20:38.143Z
But what if the address has never made a transaction and thus the public key is not revealed? Is it impossible to verify it then?
Arturo Torres Sánchez
CC BY-SA 3.0
2015-02-22T21:22:11.507Z
If the address has never made a transaction, what is the receiver actually receiving? In that case, there isn't anything transferred between the parties (at least on the blockchain) and there's no need to verify anything.
Jimmy Song
CC BY-SA 3.0
2015-02-23T02:42:58.173Z
@jimmysong Then what about the receiver. Receiver doesnt need to provide his public key until he wants to spend the money. Am I right?
abeikverdi
CC BY-SA 3.0
2015-02-23T03:17:07.100Z
Yes, addresses generally shouldn't be exposing their public keys until they're ready to spend. This is a good way to protect against ECDSA being broken in some way. Right now, an attacker would have to break SHA256, RIPEMD160 and the SECP256K1 curve to break that security.
Jimmy Song
CC BY-SA 3.0
2015-02-22T20:01:18.573Z
2015-02-22T20:01:18.573Z
Jimmy Song
<p>I understand how ECDSA exactly works and for verification of a signature, the public key of the signer is required. But in Bitcoin, public key is double hashed and the only information the receiver knows is the sender's address.<br/>
Then my question is that how the receiver can verify the senders signature without knowing his public key?</p>

<signature><ecdsa><verification>
How can someone verify the signature of a Bitcoin ECDSA signature without knowing the signer's public key?
abeikverdi
# How can someone verify the signature of a Bitcoin ECDSA signature without knowing the signer's public key?

(Asked by: username_0 on 2015-02-22)

I understand how ECDSA exactly works and for verification of a signature, the public key of the signer is required. But in Bitcoin, public key is double hashed and the only information the receiver knows is the sender's address.  
Then my question is that how the receiver can verify the senders signature without knowing his public key?

**Tags:** signature, ecdsa, verification


---

## 2 answers

### Answer by username_2 on 2015-02-22. Score: 8 | Accepted answer

Simple, the sender shows the pubkey when spending from whatever address the bitcoins are in. As part of the verification, the receiver (actually, every node in the network), can verify that the pubkey hashes to the address given and then and only then verifies the signature.

> **Comments:**
> **username_3**: But what if the address has never made a transaction and thus the public key is not revealed? Is it impossible to verify it then?  
> **username_2**: If the address has never made a transaction, what is the receiver actually receiving? In that case, there isn't anything transferred between the parties (at least on the blockchain) and there's no need to verify anything.  
> **username_0**: @username_2 Then what about the receiver. Receiver doesnt need to provide his public key until he wants to spend the money. Am I right?  
> **username_2**: Yes, addresses generally shouldn't be exposing their public keys until they're ready to spend. This is a good way to protect against ECDSA being broken in some way. Right now, an attacker would have to break SHA256, RIPEMD160 and the SECP256K1 curve to break that security.  

---

### Answer by username_1 on 2015-02-23. Score: 2

```
static bool verify ( const QByteArray& dgst, const QByteArray& pub, const QByteArray& sig )
{
  return 0 < ECDSA_verify ( 0, (const quint8*)dgst.constData ( ), 32,
    (const quint8*)sig.constData ( ), sig.size ( ), EC_KEY_pub_key ( pub ) );
}

```


---

