Public and private keys
Public and private keys
What are public and private keys? More to the point, what do they do? It’s not a particularly simple topic, so let’s break it down into bite-sized chunks.
Public and private keys are a sophisticated form of cryptography that help to secure cryptocurrency transactions. Cryptography is an essential feature of cryptocurrency (hence the name).
Modern cryptography uses a combination of mathematics, computer science, electrical engineering, communication science and physics to create nearly uncrackable codes – or ‘keys’. These are used to prevent third parties from gaining illegitimate access to or knowledge of sensitive information.
So, what are these ‘keys’?
In cryptography, a ‘key’ is a string of data - alphanumeric characters to be precise - that is used to decrypt, or ‘unlock’, a block of encrypted text and turn it into plaintext (readable text). It also works the other way around – it can encrypt, or ‘lock’, plaintext.
There are many different variations of cryptographic keys, but in the world of cryptocurrency you just need to be aware of public and private keys.
These keys work together to help secure the cryptocurrency ecosystem. When you make your first cryptocurrency transaction, you will receive two unique keys for the wallet you utilise - one public and one private. This pairing of keys is also known as ‘asymmetrical cryptography’.
What is a private key?
Your private key is a 256-bit number that is 64 characters long. It’s essentially your unique digital ID that allows you carry out any kind of cryptocurrency transaction. You should never share this number with others, as otherwise you risk losing all your funds.
Each time you make a transaction on the network, the validity of that transaction needs to be confirmed by nodes. Nodes are basically the computers (and the people operating them) which validate cryptocurrency transactions and add them to the blockchain.
The transaction is signed off by you, using your private key - but that’s just the first step. To fully confirm the transaction, you also need a public key.
What is a public key?
A public key acts as your public address on the network. It’s a very long string of numbers compressed down into a much shorter version that you can share with others – like a bank account number. When someone wants to send you cryptocurrency, they need to know your public key to process the transaction.
A public key is created by applying a very clever algorithm to your private key. The two keys are closely connected so that during a transaction you can prove two things; namely that you are the owner of the private key and that you can receive funds to your public address.
To summarise - you use your public key to receive funds and your private key to transfer or spend your funds. If you lose your private key, your funds will be inaccessible forever. Your public key, however, can be recovered using your private key, so it doesn’t matter as much if you were to lose it.
Your private and public keys are stored in your digital wallet. We spoke about digital wallets in an earlier lesson, so have a quick revision if you need a refresher!