New: Introducing the world's first secure touchscreen hardware wallets

Shop Now

Up your Web3 game

Ledger Academy Quests

  • Test your knowledge
  • Earn POK NFTs
Play now See all quests

The Classroom

PATHWAY J) Wallet Knowledge II - The Evolution of Crypto Storage

chapter 1/4

Public Vs Private Keys: Understanding PKC in Crypto

Read 4 min
Beginner
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’ve been dabbling in crypto for a little while, you may be wondering how on earth your crypto wallet works. You wouldn’t be alone, as they aren’t the most straightforward pieces of tech to grasp. 

Of course, there are many sides to how a crypto wallet works: the underlying blockchain tech that allows it to operate, the device you use to initiate the transaction, and how that device interacts with the network. But if you want to take a deep dive into understanding crypto wallets, you may want to start with how they work on the blockchain first. 

You probably already know that your crypto wallet uses public and private keys to operate. But did you know that public and private keys existed long before cryptocurrency? It’s all thanks to a cryptography concept called Public Key Cryptography (PKC) or Asymmetric Encryption.

But what on earth is that exactly? 

The Origin of Public and Private Keys

The general purpose of PKC is to enable secure, private communication using digital signatures in a public channel with potentially malicious eavesdroppers.

In doing so, PKC allows for transitions from one state to another while making reversing the process nearly impossible. This process proves you have access to the secret without exposing it to any other parties. To do this successfully, PKC uses an important one-way mathematical concept called a Trapdoor function. Put simply, Trapdoor Functions are mathematics problems that are easy to compute in one direction but nearly impossible to reverse.  In essence, it’s perfect for validating authenticity as the trapdoor function means it cannot be forged. 

To clarify, 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 as Prime Factorization are the trapdoor functions that make reverse-engineering (i.e., forging) cryptographic signatures impossible. Essentially it requires the computer to solve a virtually unsolvable math problem. 

To keep you secure, PKC relies on a two-key model: the public and private keys. It’s these two important components that work together to keep your important information safe. But what’s that to do with crypto?

Public and Private Keys in Cryptocurrency

Well, private and public keys are integral for public blockchains to operate. In the context of cryptocurrencies, PKC is used to prove that a transaction was signed by the owner of the funds rather than the result of forgery. 

So how does that fit into the blockchain tech you already know about? And what on earth does “signing” a transaction entail? Let’s refresh ourselves on how public and private keys work in crypto wallets first.

Public and Private Keys in Crypto Wallets

Typically, crypto wallets each use a private and public key. To clarify, your public key can be shared with anyone. Conversely, your private key is the code that will allow anyone access to the funds stored at that public address. 

But actually, there’s a little more to it than that.

What Are Private Keys?

Private keys are at the base of every blockchain account, and necessary for even the simplest of actions. For starters, when people say they “own” cryptocurrencies, what they really own is the private key to the wallet that stores those assets. To clarify, cryptocurrencies are always stored on the blockchain network, not within a crypto wallet itself. Instead, you own the private key that allows access to the account. 

This private key unlocks the right for its owner to spend the associated cryptocurrencies. However, should anyone get hold of it, it would also grant them access to your account. That’s why – as the name suggests – it should remain private. There’s only one private key to your account and it functions as your private password only you should know.

However, your private key doesn’t just grant access to funds, it controls the whole basis of how your crypto wallet works and how you interact with other accounts. Most crypto wallets will actually use your private key to create your public key. 

What Are Public Keys?

Public keys are visible to all users in the network, and sometimes even beyond the network too. Essentially, public keys act like an account number. They make each wallet uniquely identifiable to participants on the network. Like the private key, a public key is made up of a long sequence of numbers. Typically, it’s generated using the private key, but that’s not always the case. It also allows you to create something you’re probably more familiar with, a blockchain address. Usually, your blockchain address is just a hashed version of that public key.

What Is a Blockchain Address?

Your blockchain address is the code you can share with others to receive cryptocurrencies. Typically, it’s derived from your public key. When you send cryptocurrency to someone else, this is the address they will see. For Ethereum, it’s that long hexadecimal number starting with 0x. Then for Bitcoin, you might notice that your wallet will generate a new address each time you transact. Both of these methods are fine, and, to clarify, this blockchain address is completely safe to share. 

Public Vs Private Keys: How Do They Work?

So now you know what private and public keys are; what about how they work? Well, each of them has its specific roles but is equally important when executing transactions or signing approvals. That said, how your public and private keys interact depends entirely on what you’re trying to do with your crypto wallet. 

While PKC allows for encryption and signing, crypto networks only use the latter. Signing is for verifying the authenticity of a transaction, guaranteeing it wasn’t forged or tampered with. Let’s see how it works.

Signing a Transaction with your private key

For example, let’s say you want to send 1ETH to your friend Bob using the Ethereum Network. In this case, you would find out Bob’s blockchain address, which. Just like you, Bob also has a set of public and private keys, and his private key is the only one that controls the address of the corresponding public key. 

When you try to send any Ether, you will have to initiate a transaction request. Within that request, you specify the amount you want to send and where you want to send it—in this case we want to send 1 ETH to Bob’s account. From there, your crypto wallet uses your private key to sign the transaction.  A signature is like a digital fingerprint; it proves to the blockchain that you intend to carry out the plan in the attached message. It also proves you are who you say you are. Your signature is created by your private key and includes the transaction details, which eventually become part of the transaction’s data. 

Once you sign, the signed transaction is broadcast to the network. That means every node in the network can review it. In this example, Ethereum validators verify that the signature matches your public key, guaranteeing you are who you say you are, and thus own the funds that you are trying to spend. They also check that Bob’s address actually exists on the network and that the transaction is sound overall. If the conditions are met, the transaction will be confirmed. The 1 Ether will disappear from your account and arrive in Bob’s.

As the owner of your private key, only you can sign the transaction capable of moving your funds. As long as you keep your private key private, no one can move your funds on the blockchain. Yes– even though you are sharing your public key, your address, and the signatures of all your transactions, your funds remain safe. This is the brilliance of trapdoor functions in action. 

Private Vs Public Keys: The basis of your crypto wallet

Of course, public and private keys are just the beginning of understanding the inner workings of your crypto wallet. While they provide the basis for peer-to-peer transfer of value, crypto wallets have evolved to do much more. Today, there are countless different types of wallets, each using this technology slightly differently. 

Want to know more about your crypto wallet? Read on to dive into how today’s wallets work, allowing you to manage countless accounts from a single interface.


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


Your email address will only be used to send you our newsletter, as well as updates and offers. You can unsubscribe at any time using the link included in the newsletter.

Learn more about how we manage your data and your rights.