As the name suggests, cryptocurrencies rely heavily on cryptography to support network security. There are many important topics in this sphere, but three of the most important are public key cryptography, elliptic curve cryptography, and cryptographic hash functions.
Note: we strongly recommend that readers look through our section on Mining prior to diving into this section.
Public key cryptography was introduced in the late 70’s, and has revolutionized the way that we communicate securely. Public key cryptography is what allows us to use digital signatures with cryptocurrency transactions. The cryptography is composed of two parts:
In reality, the public and private keys are entirely digital, and represented by strings of 1’s and 0’s. But to craft a clearer picture of how exactly public key cryptography works, let’s assume for a moment that these are real keys.
You own a super sturdy, unbreakable treasure chest. It’s bolted to the floor in your office, and it has a big lock installed on it. As it turns out, the lock on the chest is a special lock with three positions. Turning the lock to the left is position 1 (locked), turning it to the center is position 2 (unlocked), and turning it to the right is position 3 (locked). Only in the middle position is the chest unlocked.
You find a talented locksmith who makes you two different kinds of keys. One key only turns to the right, from position 1 to 2 to 3. You keep this key safe. It’s yours. It’s your “private key.”
The other key turns only to the left, from position 3 to 2 to 1. You make a ton of copies of this key and give them out to friends, family, and coworkers. It’s your “public key.”
You might get some pretty important, um, mail n’ stuff at your office building. You don’t want anyone to steal it! You come up with the idea to have everyone leave their packages and notes for you in the totally secure, indestructible chest.
“If you want to give me anything when I’m not around, put it in the chest and lock it!” you declare. Then, you put the lock into the center position (2), unlocking it.
Anyone with a public key can deposit important information into the chest and turn left (to position 1, locking the chest). However, you are the only one who can turn the lock back towards the center (your private key turns to the right).
In this system, anyone can leave you packages and lock the chest. No one besides you can unlock the chest.
This piece of our analogy gives you an idea of how public key cryptography can be used to protect sensitive information from prying eyes, while still allowing anyone to send you information.
This system has another advantage. Let’s say that rather than receiving information from others, you want to send a message to someone–and you want them to know for certain that it was you (and only you) who sent it.
You can use your private key to turn the lock on the chest all the way to the right, at position 3. This way, anyone with a public key can turn the lock to the left, back to position 2, and unlock the message. And because you’re the only person who can turn the lock to position 3, the recipient will know that it must have been you who left the message. Assuming you are the only one with a private key, only you could have turned the lock to position 3.
So, the recipient of a package will know for certain that it was you who sent it.
This process is what underlies the idea of digital signatures, which is discussed in the Mining section.
How does this apply to cryptocurrencies? Well, each crypto transaction must have a digital signature. A digital signature is equivalent to you turning the lock to position 3, because only you have the power to do that.
Public and private keys are ubiquitous in the crypto world. Everyone has your public key, and can leave things in your chest. Only you can unlock the chest and take things out. Instead of using metal keys, we use digital ones, made of long, random strings of numbers.
Public key cryptography was the basis for much of what would eventually make up Bitcoin.