What Are Public And Private Keys? (2023)

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.

Private Key Explained

When it comes to Bitcoin, the private key is used to prove unique ownership of your bitcoins. It’s what’s used to create the signature which authorises the spending of the funds and as such, should be kept secret at all times. While anyone can view bitcoin funds, only those with the unique private key can spend them.

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

Public keys are generated from the private keys and then from that public key a Bitcoin Address is generated. This is where the funds are then sent to in the Bitcoin network. Public keys can be shared with anyone and do not need to be kept secret.

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 public key without hackers reverse engineering their private keys from it.

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 even two sometimes) 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:

….10110110101010101011011010101111010101101011101011….

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

…900 1202 689 1586 604 1390….

Those decimal numbers are then used to select the corresponding word from the standard BIP39 wordlist:

….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 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 your software 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

Public Private Key Explained

Public and private key cryptography has been around for much longer than Bitcoin and is used in many other applications. A private key is something that you should always keep private and never disclose to anyone, ever. It’s used to “digitally sign” things to prove that you’re the owner.

From this private key, the corresponding public key is generated. This public key can be shared publicly far and wide and is what others use to verify that you alone hold the private key and are the owner of whatever it is you digitally signed.

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.

From here, the wallet broadcasts the transaction to the network and once the Transaction Has Been Confirmed into a new block, the funds are considered “spent”. 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!