The term cryptocurrency is used frequently, but have you taken the time to stop and think what it actually means. The second half of the word is simple currency it’s a type of money, but what does crypto mean and why is it useful? Cryptography can be a complicated subject but today we break it down and provide a simple explanation of why we need cryptography for cryptocurrencies and more specifically how public and private keys work.
Public / Private Keys and the Internet
Cryptography is something that we use in our day-to-day life without even realising it, it is one of the foundations of the internet that allows us to trade safely online and for e-commerce to flourish. Take a look at the address bar on this page right now, you should notice two things the address starts https and there is a little padlock symbol. The https and padlock at the start of an address are telling us that the connection to a website is secure, this is achieved through public key cryptography which encrypts all the data going to and from yourself to the website. This encryption or scrambling of data is essential for trade on the internet otherwise thieves could capture payment information as it was entered into a website.
Bitcoin Digital signing with Private Keys
So cryptography is all about encryption? That’s one of its uses but not the most useful aspect for cryptocurrencies. Cryptography in Bitcoin and other cryptocurrencies is all about being able to digitally verify our identity and sign transactions. Using cryptography to verify our identity with a Bitcoin transaction is analogous to using handwritten signatures and pin codes in today’s banking systems, we are proving our identity to unlock our funds and authorise the spend.
Public / Private Keys Cryptocurrencies
Let’s look at how public / private key cryptography works, public and private keys exist as pairs or key pairs. They’re called pairs because the two sets of keys are related to each other. It starts with the private key which is just a number picked at random. From this number a mathematical algorithm such as elliptic curve manipulation is used to generate a corresponding public key. What’s unique about these mathematical algorithms used is that it is a one-way process, so you are able to generate the public key from the private key but you are not able to generate or guess the private key from the public key.
The below diagram shows a public private key pair and demonstrates the generation process for the public key. Take note of the key points:
- The private key and public key are related
- The public key is generated from the private key
- The generation process is one way. It is mathematically un-feasible to guess the private key from the public key .
In summary this is useful for cryptocurrencies because we are able to sign or verify transactions with a private key which no one can guess. Let’s look at Bitcoin to see how this all hangs together and how we are using public / private key cryptography without even thinking about it when we make a Bitcoin transaction.
Putting it all together
- All transactions on the Bitcoin network are recorded on the blockchain
- Transactions are sent and received to public addresses
- Public addresses are related to the public key. They are a hash of the public key
- To release or authorise a Bitcoin transaction you need to provide the private key to unlock the funds sitting on the blockchain at the designated address
- It is safe to share public addresses since it is mathematically un-feasible to guess the private key from this
Relating this to traditional banking
If you are still scratching you head over all of this lets relate this to a practical example in today’s banking.
- Today your funds are held by a bank who record how much you have spent/ received and record your balance. In cryptocurrency your transactions and balances are recorded on the blockchain without a central authority
- To access your bank account funds you use your pin. With cryptocurrencies you use your private key. You can think of your private key as being like your bank pin
- To have funds sent to your bank account you use your account number. To receive crypto you provide your public address (a hash of your public key). You can think of your public key as being like your bank account number.
Wallets and Prublic / Private Keys
It is through wallets that we interact with the blockchain and make transactions to send or receive Bitcoin and other cryptocurrencies. Wallets store your private keys and create public keys which in turn relate to your public address for receiving funds.
If you are new to crypto take a look at our introduction to wallets and review of the different types of wallet.
Bitcoin and other cryptocurrencies are very liberating since all you need to release and spend your funds is the private key. There can be no control over your funds or denial of access by a third party, you quite literally have the key to the safe. But with great power comes great responsibility if a private key is lost there is no way or no-one to turn to, to recover it, your funds will be locked into the blockchain. Ensure that you have read our wallet safety guide
Cryptography is also used within cryptocurrencies in the mining process, but that’s a topic for another day.