Save 30% on a Ledger Nano Color. Use COLOR30 at checkout.

Shop Now

LEDGER HARDWARE WALLETS

THE SMARTEST WAY TO SECURE YOUR CRYPTO

Buy, exchange, grow and manage over 5,500 coins and tokens

Shop now Compare wallets

What Are Public Keys Vs Private Keys?

Read 4 min
securitycover
KEY TAKEAWAYS:
— The goal of public and private keys is to prove that a spent transaction was indeed signed by the owner of the funds, and was not forged.

— When you own cryptocurrencies, what you really own is a “private key” which unlocks the right for its owner to spend the associated cryptocurrencies. As it provides access to your cryptocurrencies, it should remain private.

— It’s possible to recover the public key if you own the private key. However, it’s impossible to find the private key using only the public key.

If you want to understand the theory behind how your wallet works, it’s important to understand the nuances of public vs private keys. This is the basis upon which your whole interaction with web3 is based. But actually, the concept of public and private keys existed long before cryptocurrency. It’s actually a cryptography concept called Public Key Cryptography (PKC) or Asymmetric Encryption.
But before we dive into the technicalities, let’s start with the basics.

Public Keys vs Private Keys: What’s The Difference

Your public key is the address to your blockchain wallet you can share with anyone, and a private key is the code that will allow anyone access to the funds stored at that public address. 

There is a cryptographic link between the public key and the private key. It’s possible to recover the public key if you own the private key. However, it’s impossible to find the private key using only the public key. Public and private keys are subsequently analogous to an email address and password, respectively. 

To explain the technicalities. Let’s explain each of these keys a little deeper.

What are Private Keys

When you own cryptocurrencies, what you really own is a “private key.” Your “private key” unlocks the right for its owner to spend the associated cryptocurrencies. As it provides access to your cryptocurrencies, it should – as the name suggests – remain private. There’s only one private key, and it functions as your private password only you should know. A private key is imperative to keep safe from prying eyes.

However, youThis private key allows you to generate multiple public keys, from that single private key. 

What are Public Keys

Once you create a public key address, it is publicly visible to all users in the network. This is the address you can share with others to receive cryptocurrencies, such as Bitcoin. When you send cryptocurrency to someone else, they will only see your public address associated with the transaction. However, only the owner of the private key can access the cryptocurrencies sent to that specific public address.

The Origin of Private and Public Keys

Public and private keys are an integral component of cryptocurrencies built on blockchain networks that are part of a larger field of cryptography known as Public Key Cryptography (PKC) or Asymmetric Encryption. 

Public key and Private key

The goal of PKC is to trivially transition from one state to another while making reversing the process nearly impossible, and in the process, proving you have a secret without exposing that secret. The product is subsequently a one-way mathematical function, which makes it ideal for validating the authenticity of something (i.e., a transaction) because it cannot be forged. PKC relies on a two-key model, the public and private key, often represented by a padlock (public key) and the actual key to access the padlock (the private key).

The general purpose of PKC is to enable secure, private communication using digital signatures in a public channel with potentially malicious eavesdroppers. In the context of cryptocurrencies, the goal is to prove that a spent transaction was indeed signed by the owner of the funds, and was not forged, all occurring over a public blockchain network between peers. 

So, how do they work exactly?

How Do Public and Private Keys Work?

Trapdoor function

Public Key Cryptography (PKC) is built around the mathematical concept of a “Trapdoor Function”. Put simply, Trapsoor Functions are mathematics problems that easy to compute in one direction but nearly impossible to reverse.  

Solving this problem will take computers enormous amounts of time (i.e., thousands of years) to compute the correct answer. In the context of PKC, such mathematical tricks like Prime Factorization are the trapdoor functions that make reverse-engineering (i.e., forging) cryptographic signatures impossible because it requires the computer to solve a virtually unsolvable math problem. 

Private key and Public key

Public Vs Private Keys in Action

Your private key is your personal digital signature which you can use to approve transactions, such as sending cryptocurrencies to other addresses or buying digital assets.

For example, let’s imagine Alice wants to send Bob 1 Bitcoin through a public channel that Charlie is listening to. Firstly, she would set up a transaction that defines how much she wants to send and who she wants to send it to. In this case, she wants to send 1 BTC to Bob using his public address. This creates a transaction hash (or hash output) that only Bob’s private key can read. To explain, a hash output is a fixed-length string of numbers that acts like the blockchain’s version of a receipt.

Alice signs the transaction hash using her private key, which controls her public address. In doing so, she verifies she has the power to send cryptocurrency from this address. Next, nodes authenticate the transaction, verifying the source and its contents. For example, if Alice doesn’t have 1BTC to send, the nodes will reject the transaction. If she does have the funds to send, the transaction will be approved.

As a result, the next time Bob wants to spend the 1BTC, the nodes can approve the transaction. This is because Bob’s private key can read the transaction hash Alice created with his public address.

crypto transaction

Charlie is not capable of reading the sensitive information that would allow him to retrieve the BTC. His private key can not translate a hash intended for Bob. Better still, neither Bob’s, nor Alice’s, public keys allow Charlie to intercept the transaction. This is the brilliance of trapdoor functions in action. Charlie cannot reverse-engineer the message or private key of Alice as it’s built using a trapdoor function. 

How Private and Public Keys Work on Bitcoin’s Network

With Bitcoin, transactions are a series of users sending and receiving bitcoins to each others’ public addresses as inputs and outputs in Bitcoin’s UTXO transaction model. Alice can publish her public key on the web, and people can send bitcoin to that address knowing that Alice is the owner of the private key to those funds. More generally, nodes (people running the Bitcoin software) in Bitcoin automatically check and validate transactions in the network to make sure none of them were forged. To do so, they use basic consensus rules and cryptographic proofs to verify that the public/private key pairs are valid (Proof of work) . As a result, it is nearly impossible to forge transactions in cryptocurrencies like Bitcoin that use PKC since they are protected by the assumptions of mathematical proofs.

Keep learning! If you enjoy getting to grips with crypto and blockchain, check out our School of Block video How to Keep Your Crypto Safe.


Stay in touch

Announcements can be found in our blog. Press contact:
[email protected]

Subscribe to our
newsletter

New coins supported, blog updates and exclusive offers directly in your inbox