<p>To claim (spend) the bitcoin from an address one needs to create a transaction and provide two things: </p>

<ul>
<li>a public key (from which the address you are trying to access is actually derived from**) and </li>
<li>a signature of the transaction (with the private key that corresponds to the above public key**)</li>
</ul>

<p>When you spent some money from an address the rest will typically go back to the originating address as change (see section Output <a href="https://en.bitcoin.it/wiki/Transaction" rel="nofollow">here</a>).</p>

<p>You are correct that the public key will be exposed after the first transaction. An attacker would have your public key. However, this poses no threat since the public key can be, well, public without compromising security. This is how <a href="https://en.wikipedia.org/wiki/Public-key_cryptography" rel="nofollow">public key cryptography</a> works.</p>

<p>It is the signature that provides the real security. To create such a signature one needs the private key corresponding to the public key. And that is never revealed in the blockchain. </p>

<p>The above two links provide a lot of detail of how public key cryptography and bitcoin transaction work.</p>

<p>** Note that a bitcoin address is created from the public key with a one-way function (the reverse is not possible). Similarly, a public key is created from the private key with a one-way function. i.e. with the private key one can re-create the rest.</p>

CC BY-SA 3.0
2016-01-14T14:51:12.633Z
"the second component is an ECDSA signature over a hash of a simplified version of the transaction." It should be the sign of previous transaction, Is that correct?
Carpemer
CC BY-SA 3.0
2016-01-15T09:56:35.363Z
Yes, that is correct.
karask
CC BY-SA 3.0
2016-01-13T18:35:33.433Z
2016-01-13T18:35:33.433Z
karask
<p>Regular Bitcoin transactions are push payments. There is no way to withdraw money from an address, it must be sent. Except for diminishing privacy there is no security risk to revealing a public key.</p>

<p>A replay attack is not possible, because balances are encapsulated in Unspent Transaction Outputs. While they can be signed over by the owner of the private key of an address, they are identified by the transaction they originated from. Unspent Transaction Outputs are used up completely when a transaction is created, therefore they are not available for a replay attack.</p>

CC BY-SA 3.0
2016-01-13T13:17:41.173Z
2016-01-13T13:17:41.173Z
Murch
<p>Because every time when someone want to spend some money under an address, he need to provide public key and sent the content to the mainnet. (Please correct me if that is not correct)</p>

<p><a href="https://bitcoin.stackexchange.com/questions/8195/where-can-i-look-to-see-a-revealed-public-key">Where can I look to see a revealed public key?</a></p>

<p>If there is some remaining money under this address, is that possible that the other will copy the public key and generate another request(with this copy) to use those money?</p>

<transactions><public-key>
Is that safe to expose public key to the mainnet
Carpemer
# Is that safe to expose public key to the mainnet

(Asked by: username_0 on 2016-01-13)

Because every time when someone want to spend some money under an address, he need to provide public key and sent the content to the mainnet. (Please correct me if that is not correct)

[Where can I look to see a revealed public key?](https://bitcoin.stackexchange.com/questions/8195/where-can-i-look-to-see-a-revealed-public-key)

If there is some remaining money under this address, is that possible that the other will copy the public key and generate another request(with this copy) to use those money?

**Tags:** transactions, public-key


---

## 2 answers

### Answer by username_1 on 2016-01-13. Score: 2 | Accepted answer

To claim (spend) the bitcoin from an address one needs to create a transaction and provide two things:

* a public key (from which the address you are trying to access is actually derived from\*\*) and
* a signature of the transaction (with the private key that corresponds to the above public key\*\*)

When you spent some money from an address the rest will typically go back to the originating address as change (see section Output [here](https://en.bitcoin.it/wiki/Transaction)).

You are correct that the public key will be exposed after the first transaction. An attacker would have your public key. However, this poses no threat since the public key can be, well, public without compromising security. This is how [public key cryptography](https://en.wikipedia.org/wiki/Public-key_cryptography) works.

It is the signature that provides the real security. To create such a signature one needs the private key corresponding to the public key. And that is never revealed in the blockchain.

The above two links provide a lot of detail of how public key cryptography and bitcoin transaction work.

\*\* Note that a bitcoin address is created from the public key with a one-way function (the reverse is not possible). Similarly, a public key is created from the private key with a one-way function. i.e. with the private key one can re-create the rest.

> **Comments:**
> **username_0**: "the second component is an ECDSA signature over a hash of a simplified version of the transaction." It should be the sign of previous transaction, Is that correct?  
> **username_1**: Yes, that is correct.  

---

### Answer by username_2 on 2016-01-13. Score: 1

Regular Bitcoin transactions are push payments. There is no way to withdraw money from an address, it must be sent. Except for diminishing privacy there is no security risk to revealing a public key.

A replay attack is not possible, because balances are encapsulated in Unspent Transaction Outputs. While they can be signed over by the owner of the private key of an address, they are identified by the transaction they originated from. Unspent Transaction Outputs are used up completely when a transaction is created, therefore they are not available for a replay attack.


---

