<p>The transaction's INPUT has ScriptSig which is both the signature as well as the public key.</p>

<ul>
<li><a href="http://en.bitcoin.it/wiki/Transaction#Data" rel="nofollow">http://en.bitcoin.it/wiki/Transaction#Data</a></li>
</ul>

CC BY-SA 3.0
2013-03-19T12:09:52.473Z
`The script contains two components, a signature and a public key. The public key belongs to the redeemer of the output transaction and proves the creator is allowed to redeem the outputs value.`

So it's the receiver's public key. How does that help?
Phlexonance
CC BY-SA 3.0
2013-03-19T21:50:20.090Z
No, the script contains the spender's public key. It is like saying - "here is a check to address X. I own that address, here is a proof: I have a public key Y, it turns into address X, and here is a signature from my private key that can be verified with Y". The sender proves that they know the public key and that they posses the private key. An address is just a way of saving space.
ThePiachu
CC BY-SA 3.0
2013-12-21T05:41:02.250Z
the input transactions i have looked at just contain the signature and no public key. i'm guessing that the public key comes from the output of the previous referenced transaction being spent (located using the previous output hash and index number). is this correct?
mulllhausen
CC BY-SA 3.0
2014-01-17T04:32:21.720Z
@mulllhausen How could that possibly work? If the previous transaction were from A to B and C, it wouldn't contain the public keys for B and C, just the addresses. So when B wants to spend that input, they must put their public key in the transaction.
David Schwartz
CC BY-SA 3.0
2014-01-18T23:36:17.487Z
@DavidSchwartz it seems to be the case when spending a coinbase transaction as i understand it. take a look at this question for an example - http://bitcoin.stackexchange.com/questions/19081/parsing-bitcoin-input-and-output-addresses-from-scripts - but please correct me if i am wrong.
mulllhausen
CC BY-SA 3.0
2013-03-19T11:47:18.183Z
2013-03-19T11:47:18.183Z
Stephen Gornick
<p>I've skimmed through the <a href="https://en.bitcoin.it/wiki/Protocol_specification">https://en.bitcoin.it/wiki/Protocol_specification</a> and it seems that when sending someone bitcoins, I would sign the transaction data (not quite sure which parts exactly) with my private key, so that people could verify it with my public key, <strong>but</strong> my address is a digest of my public key, so where do people get my public key from?</p>

<transactions><address><public-key><signature>
If addresses are hashes of public keys, how are signatures verified?
Phlexonance
# If addresses are hashes of public keys, how are signatures verified?

(Asked by: username_0 on 2013-03-19)

I've skimmed through the <https://en.bitcoin.it/wiki/Protocol_specification> and it seems that when sending someone bitcoins, I would sign the transaction data (not quite sure which parts exactly) with my private key, so that people could verify it with my public key, **but** my address is a digest of my public key, so where do people get my public key from?

**Tags:** transactions, address, public-key, signature


---

## 1 answers

### Answer by username_1 on 2013-03-19. Score: 2

The transaction's INPUT has ScriptSig which is both the signature as well as the public key.

* <http://en.bitcoin.it/wiki/Transaction#Data>

> **Comments:**
> **username_0**: `The script contains two components, a signature and a public key. The public key belongs to the redeemer of the output transaction and proves the creator is allowed to redeem the outputs value.`  So it's the receiver's public key. How does that help?  
> **username_2**: No, the script contains the spender's public key. It is like saying - "here is a check to address X. I own that address, here is a proof: I have a public key Y, it turns into address X, and here is a signature from my private key that can be verified with Y". The sender proves that they know the public key and that they posses the private key. An address is just a way of saving space.  
> **username_3**: the input transactions i have looked at just contain the signature and no public key. i'm guessing that the public key comes from the output of the previous referenced transaction being spent (located using the previous output hash and index number). is this correct?  
> **username_4**: @username_3 How could that possibly work? If the previous transaction were from A to B and C, it wouldn't contain the public keys for B and C, just the addresses. So when B wants to spend that input, they must put their public key in the transaction.  
> **username_3**: @username_4 it seems to be the case when spending a coinbase transaction as i understand it. take a look at this question for an example - http://bitcoin.stackexchange.com/questions/19081/parsing-bitcoin-input-and-output-addresses-from-scripts - but please correct me if i am wrong.  

---

