Skip main navigation

How do Public and Private Keys Work?

Public and private keys are the key concepts of asymmetric cryptography - a method used to protect identities and data from unauthorized access. Using a cryptographic algorithm, the keys are mathematically connected in such a way that you can derive the public key from the private key, but you cannot take the public key and get its paired private key.
Hand holding key
© Photo by cottonbro from Pexels

Public and private keys are the key concepts of asymmetric cryptography – a method used to protect identities and data from unauthorized access. Using a cryptographic algorithm, the keys are mathematically connected in such a way that you can derive the public key from the private key, but you cannot take the public key and get its paired private key.

Asymmetric Encryption

Together, the two keys are used to encrypt and decrypt messages. If you encrypt a message using a person’s public key, the message can only be decrypted by the recipient using the matching private key. Thus, encrypted messages can only be read by their intended receiver. The advantages of asymmetric encryption also include the ability to ensure the identity of the sender.

For example, Alice wants to send a message to Peter. First, she would encrypt the message using Peter’s public key, then signs the message using her private key. Then, Peter would decrypt it using his associated private key. In this example, you can think of the public key as the email address and the private key as the password. Anyone can send you a message to your email address, but only you can read it using your password. Just like an email password, private key is something you should only keep to yourself, while public key can be shared.

Private Keys and Cryptocurrency

So, how does this apply to Defi and cryptocurrency? To own crypto, you need a wallet to store your coins. The wallet has a unique address comprised of a string of random numbers and letters. This address is a compressed and shortened version of the public key. The private key acts as your digital signature, which can be used to prove ownership of coins in the wallet. 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.

Let’s take a scenario when Alice wants to send Peter some bitcoin. First, Alice needs to get Peter’s public address, which is a shorter form of his public key. She then signs the message with her private key to ensure that the transaction has not been modified. The transaction is then encrypted and verified. Peter would then decrypt the message using his private key and access the coin. Once again, Peter must keep his private key a secret because anyone that has access to that private key will also have access to any associated cryptocurrency.

Coin Burning

Finally, public and private keys are related to “Coin Burning” – a procedure used to increase and stabilise the value of coins and tokens. To remove a certain quantity of a token from the circulating supply, miners and developers send coins to a public key address without an obtainable private key (Burn address). Without access to a private key, no one can use these coins in a transaction, thus the coins are effectively unrecoverable.

Now it’s your turn

This article compares the public key with an the email address and the private key with the password. Can you think of other examples that function in a similar manner to public and private keys? Share them in the comments.

© RMIT 2021
This article is from the free online

Decentralised Finance: Blockchain, Ethereum, and The Future of Banking

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now