What Are Public And Private Keys? (2024)

Athena Alpha

Private keys. Mnemonic Sentences. Seed Phrases. If you haven’t dealt with computer system or crypto like we have for decades then it can be a bit confusing hearing all these cryptic terms and trying to understand their differences.

While many are confused it also doesn’t help that software makers and website owners all use these terms seemingly interchangeably. This leads to one “expert” explaining what something is, only to be actually talking about something else entirely.

More confusion ensues. So to ensure you have a solid foundational knowledge of this let’s explain properly what are public and private keys.

What Are Public And Private Keys?

Public and private keys are what makes up Public-Key Cryptography. In general private keys are used to encrypt data then on the other end the corresponding public key is used to decrypt it.

Public and private key cryptography has been around for much longer than Bitcoin and is used in many applications and networks such as the End-to-End (E2E) encryption you see used in messaging applications like Signal.

In the context of Bitcoin you have a number of different types of keys:

  • Extended Private Key (xPriv)
    • Child Private Keys
  • Extended Public Key (xPub)
    • Child Public Keys
Private-And-Public-Key-Structure
How keys are generated

The Extended Private Key (xPriv) is used to generate any number of “child” Private Keys. From any of those child Private Keys an Extended Public Key (xPub) is derived. This Extended Public Key (xPub) is then used to generate any number of “child” Public Keys.

When most people say “private key” or “public key” they’re usually referring to the Extended Private Key or the Extended Public Key. This is also why many use the plural “private keys” as you don’t just have 1 key as per above, you have many different private keys that’s all seamlessly managed by your wallet software.

Private Key Explained

Private keys are used to prove unique ownership of your bitcoins. It’s what’s used to sign the transaction signature which authorizes the spending of the funds and as such, should be kept secret at all times. Only those with the unique private key to a UTXO can spend it.

Without the private keys you don’t actually have control over anything. This is why the saying “not your keys, not your coins” came about. Allowing someone else to custody or hold the private keys to your funds (like centralized exchanges do) means you own zero bitcoins.

It’s incredibly important that you never share your private keys with anyone, ever!

Public Key Explained

While private keys are used to spend your funds, public keys are used to receive funds.

Your individual child Public Keys are used to generate a Bitcoin Address which is where bitcoin funds are sent to.

Each Public Key corresponds to a Bitcoin Address with the master Extended Public Key (xPub) being able to generate all possible Public Keys in the entire wallet.

Sharing of the Extended Public Key (xPub) is strongly discouraged as anyone who has it can see all addresses, the total balance for that wallet and all historic and future transactions. It’s a huge breach of privacy, even though they cannot spend any of your funds.

Sharing a single bitcoin address, generated from a child Public Key, is fine though as otherwise you’d never be able to receive any bitcoin! That being said, do your best to ensure your real world identity is never linked to any bitcoin address.

Another very important property of private/public key pairs is that it’s very easy to create the public key from the private key, however it’s near impossible to do the reverse. This allows anyone to share their bitcoin address without hackers reverse engineering their private keys from it.

Finally, make sure you are always generating a new bitcoin address for every transaction. Your wallet can generate an infinite amount of them for free, so every time you receive bitcoin, generate a new address for it. Once you’ve spent that bitcoin, never use that address again. This goes a long, long way to help keep your bitcoin funds private and secure.

How Are Public And Private Keys Generated?

A Bitcoin private key is just a very large (256 bit), randomly generated number.

Obviously anyone or anything can “generate a number” but the very important part of it all is making sure that it’s truly random. The industry standard to do this uses a secure random number generator (or two) to generate what’s called entropy. A sufficient amount of entropy is what allows for a truly random set of binary numbers to be generated: and a properly secure key

….10110110101010101011011010101111010101101011101011….

These number are then split into groups of 11 bits and converted to decimal numbers:

…900 1202 6839 1586 604 1390….

Those decimal numbers are then matched to the corresponding word from the BIP39 word list:

….identify north file shock entire punch…

This group of 12 or 24 words is what’s called a Mnemonic Sentence but is also often referred to as a Seed Phrase, seed words,, seed, seed recovery phrase or backup Seed Phrase.

Example Mnemonic Phrase
No, there’s no bitcoins in it

The Mnemonic Sentence is what’s actually shown to the user by the Bitcoin Wallet software as shown above. If you’ve dealt with Bitcoin or pretty much any cryptocurrency you’ll be familiar with Mnemonic Sentences and most importantly backing them up.

Bitcoin Private Keys

While most explanations of private keys rarely go into the above detail let’s dive a bit deeper still as you’re obviously the curious type. Once any Bitcoin wallet has your Mnemonic Sentence it continues to derive even more keys.

From your Mnemonic Sentence is generates the Master Extended Key. The Master Extended Key is also referred to as your Private Keys (as it contains your Private Key + Chain Code) and is often confused with the Mnemonic Sentence / Seed Phrase itself.

It’s an important distinction to be made though as the Mnemonic Sentence is what’s used to generate the Master Extended Key, so they’re clearly not the same thing.

The Master Extended Key is then used to generate your Private Key (also called Master Node) which is then used to generate virtually unlimited private/public key pairs. This is how most wallets work and although it might seem like an extremely convoluted and complex way of doing things it has the awesome benefit that all you as a user have to remember and backup is those 12 words that make up the Mnemonic Sentence.

Although “saving 12 words” seems like a pretty simple task, there’s a huge array of possible options, many of which are terrible, terrible solutions that can lead to you getting hacked or other bad things. This is why we’ve created a dedicated piece to teach you How To Protect Your Bitcoin Private Keys!

New to Athena Alpha? Start today!

Where Are My Private Keys?

From Private Key to Private Keys to Mnemonic Sentence to Master Node and more there’s a lot of cryptic terminology to deal with. At the end of the day though learning how to find your bitcoin private key isn’t hard.

Your private keys will be represented as either 12 or 24 words and should be in your wallet software. Not only should you always hold your own keys, but the wallet software you use should be able to display them to you at any time. For example, in Sparrow Wallet you can access them by going to Settings and then looking in the Keystores area

Sparrow Wallet Private Key Location Example
Location of your Private Keys in Sparrow Wallet

If you have a hardware wallet, then it should be able to display your private keys on the device itself rather than on your computer screen.

How Public And Private Keys Control Your Crypto

When it comes to the Bitcoin network private keys are used to spend your funds while public keys are used to receive funds. When someone wants to spend their bitcoin funds, their wallet takes their private key and signs the transaction. This lets the Bitcoin network know that they have the authority to spend those funds.

From here, the wallet broadcasts the Bitcoin Transaction to the network and once it’s been confirmed into a new block by Bitcoin Mining, the funds are considered “spent”. The spent funds are now controlled by the new private key that belongs to the receiver.

Simple Example:

  1. Bob has 0.1 BTC he wants to send to Alice
  2. Bob enters in Alice’s Bitcoin address (that was derived from her public key) into his wallet
  3. Bob’s wallet signs the transaction with his private key and broadcasts it to the network
  4. If Bob’s signature is valid, the Bitcoin network accepts the transaction and the 0.1 BTC will now be bound to Alice’s private key and “owned” by her

Note: There are no bitcoins in your Bitcoin Wallet. Bitcoins only exist on the Bitcoin Network, wallets only hold your private/public keys which allow you to view and spend those bitcoins. To learn how to do the above example for real, see our super easy step-by-step guide How To Send Bitcoin.

FAQ

What Is Public Key And Private Key In Blockchain/Bitcoin?

When it comes to the Bitcoin network private keys are used to spend your funds while public keys are used to receive funds. When someone wants to spend their bitcoin funds, their wallet takes their private key and signs the transaction. This lets the Bitcoin network know that they have the authority to spend those funds. The spent funds are now controlled by the new private key that belongs to the receiver.

What’s The Difference Between Public Key And Private Key?

Private Key:
– Should be kept strictly private and never shared, ever
– Used to generate the corresponding Public Key
– Used to sign things so as to prove ownership

Public Key:
– Can be shared publicly
– Used to verify the signatures and ownership

How Are Public And Private Keys Generated?

Your Bitcoin Wallet will automatically generate your private key, which is normally represented as your Seed Phrase or Mnemonic Sentence. It’s incredibly important that all Bitcoin wallets use true randomness to generate any private keys as otherwise this can put your funds at great risk.

Public-Private Key Encryption: Real World Examples

Public-Private Key Encryption is used in many cases for both businesses and individuals. From cryptocurrencies like Bitcoin, to End-to-End (E2E) encrypted messaging services like Signal to digital signatures on documents there’s hundreds of thousands of applications that use it everyday.

How Long Is A Bitcoin Private Key?

A Bitcoin private key is a 256-bit number. When represented in hexadecimal it’s 32 bytes, or 64 characters in length. For example it might look like this:

96d42bd67923f5e50911af188f2a115f96278229c6baf89bd33679d67c38a101

Most users won’t ever see this though, as your Bitcoin Wallet will present it to you in the form of a Seed Phrase. This is a group of 12 or 24 words.

Want to get serious about safely and privately using Bitcoin? You need to subscribe now.

Benefits Include:
Read by the top experts, writers, investors and companies in Bitcoin
Learn more about Bitcoin than 99% of people in just one hour a month
Secure your Bitcoin investments and ensure they stay safe from hackers
Know what risks your investments are exposed to and how to fix them
Keep pace with Bitcoins rapid growth and what opportunities it enables
Get insights into how Bitcoin can help your business or work save thousands
Step-by-step guides for all aspects of Bitcoin (wallets, buying and more)
How to do all of these things and maintain your privacy!
NO MORE LOST FUNDS!