Back

What Are Public and Private keys?

To understand how crypto transactions work, it’s essential first to learn how public and private keys work together.



Summary

Public and private keys are an integral part of Bitcoin and other cryptocurrencies. They allow you to send and receive cryptocurrency without requiring a third party to verify the transactions. These keys are a part of the public-key cryptography (PKC) framework. You can use these keys to send your cryptocurrency to anyone, anywhere, at any time. The public and private keys fit together as a key pair. You may share your public keys in order to receive transactions, but your private keys must be kept secret. If anyone has access to the private keys, they will also have access to any cryptocurrency associated with those keys.



What Is a Public Key?

A public key allows you to receive cryptocurrency transactions. It’s a cryptographic code that’s paired with a private key. While anyone can send transactions to the public key, you need the private key to “unlock” them and prove that you are the owner of the cryptocurrency received in the transaction. The public key that can receive transactions is usually an address, which is simply a shortened form of your public key.

Therefore, you can freely share your public key without worry. You may have seen donation pages for content creators or charities with the public keys for their crypto addresses online. While anyone can donate, you’d need the private key to unlock and access the donated funds.



What Is a Private key?

Here is one crucial piece of advice to remember: Never share your private key with anyone. A private key gives you the ability to prove ownership or spend the funds associated with your public address. A private key can take many forms:

  • 256 character long binary code
  • 64 digit hexadecimal code
  • QR code
  • Mnemonic phrase

Regardless of its form, a private key is an astronomically large number, and it’s large for a good reason. While you can generate a public key with a private key, doing the opposite is practically impossible because of the one-way “trapdoor” function. You can have any number of public keys connected to a private key.



What Does It Mean to “Digitally Sign” a Transaction?

For a transaction on the blockchain to be complete, it needs to be signed. The steps for someone to send you a transaction are:

  • A transaction is encrypted using a public key. The transaction can only be decrypted by the accompanying private key.
  • Next, the transaction is signed using the private key, which proves that the transaction hasn’t been modified. The digital signature is generated by combining the private key with the data being sent in the transaction.
  • Finally, the transaction can be verified as authentic using the accompanying public key.

You digitally sign a transaction to prove you’re the owner of the funds. Nodes check and authenticate transactions automatically. Any unauthenticated transactions get rejected by the network. An authentic, mined transaction on the blockchain is irreversible.