<p>The private key is used when signing a transaction. The private key usually goes into a bitcoin wallet, and the wallet software handles the signing and storage of your keys. Do not give your keys to anyone. Anyone with your private keys can spend just the same as you so it is important to keep these safe and preferably offline.</p>
<p>Yes your wallet software will verify the signature (not the key) before broadcasting as well as any listening nodes.</p>

CC BY-SA 4.0
2021-02-23T02:32:42.867Z
2021-02-23T02:32:42.867Z
m1xolyd1an
<p>There are a few steps involved here.</p>
<ol>
<li>You create an address. That address is the hash of the public key corresponding to a private key you generated. This is a purely local operation. No communication with the network (or anyone) takes place.</li>
<li>You give that address to someone.</li>
<li>They create a transaction that credits (the hash of) your public key. This hash is stored in the transaction T1, and known to the entire network once it confirms. The coins are now yours.</li>
<li>You get an address from your friend.</li>
<li>You create a transaction T2 that credits your friend's address, while spending the coin you just received. That coin was encumbered with your public key hash, so it needs a proof that the corresponding key owner agrees with the spend. For that purpose, a digital signature created with your private key on, and included with, this T2 transaction. <em>Every</em> (full) node verifies this signature. That includes miners, but they just do it because they don't want to risk creating a block that includes a transaction that is invalid (which would mean losing their payout for the block).</li>
</ol>

CC BY-SA 4.0
2021-02-23T01:27:42.390Z
2021-02-23T01:27:42.390Z
Pieter Wuille
<p>Let's imagine a situation: I want to send bitcoins to a friend. I need a private key to identify my wallet ownership. So: where is this key sent and who verifies it? Wallet (client)? Nodes? Miners? Who?</p>

<private-key>
Where does it go and who verifies private keys?
Ars Lee
# Where does it go and who verifies private keys?

(Asked by: username_0 on 2021-02-23)

Let's imagine a situation: I want to send bitcoins to a friend. I need a private key to identify my wallet ownership. So: where is this key sent and who verifies it? Wallet (client)? Nodes? Miners? Who?

**Tags:** private-key


---

## 2 answers

### Answer by username_2 on 2021-02-23. Score: 4 | Accepted answer

There are a few steps involved here.

1. You create an address. That address is the hash of the public key corresponding to a private key you generated. This is a purely local operation. No communication with the network (or anyone) takes place.
2. You give that address to someone.
3. They create a transaction that credits (the hash of) your public key. This hash is stored in the transaction T1, and known to the entire network once it confirms. The coins are now yours.
4. You get an address from your friend.
5. You create a transaction T2 that credits your friend's address, while spending the coin you just received. That coin was encumbered with your public key hash, so it needs a proof that the corresponding key owner agrees with the spend. For that purpose, a digital signature created with your private key on, and included with, this T2 transaction. *Every* (full) node verifies this signature. That includes miners, but they just do it because they don't want to risk creating a block that includes a transaction that is invalid (which would mean losing their payout for the block).


---

### Answer by username_1 on 2021-02-23. Score: 1

The private key is used when signing a transaction. The private key usually goes into a bitcoin wallet, and the wallet software handles the signing and storage of your keys. Do not give your keys to anyone. Anyone with your private keys can spend just the same as you so it is important to keep these safe and preferably offline.

Yes your wallet software will verify the signature (not the key) before broadcasting as well as any listening nodes.


---

