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?


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).

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.