In this post we will look at what cryptography is and how it relates to blockchain and bitcoin. After all, it wouldn’t be “crypto“-currencies without cryptography!

Definition: __Cryptography__ is the study of securing communication between two parties while in the presence of a third party, called an adversary.

Another way of defining cryptography is by describing it as the study or act of creating and solving difficult to break codes. This definition describes one of the key problems that the use of cryptography sets out to solve and that is to make whatever message I am trying to send to another party private even if intercepted or attained by a third party.

What do I mean by this? Thousands of years ago during the ancient Roman rule, Roman emperor Julius Caesar had a sneaky way to encode the messages he sent to others across the vast Roman empire so that only he and his intended audience knew how to read them. He didn’t worry about the message falling into the wrong hands or being intercepted by an enemy, because to them the message would simply look like a nonsensical string of letters.

The nonsensical string letters is what we call a cipher. A cipher alone is no good unless we also have a second important element, and that is called the key. The key is the rule book that tells us how to rearrange the text in the cipher into something readable, hence decipher. In the instance above, the key to Julius Caesar’s cipher was to replace every letter in the cipher by the letter that is one place to the left of it in the alphabet. If the letter “B” appears in the cipher text, you would replace it with an “A” to decode it. An example of this is shown below.

The caesar cipher above is a very simple cipher, especially by today’s standards considering where computing power is today. It’s vital that the codes we create to encrypt our messages are complex enough so that they cannot be reverse engineered or figured out by simply trying every possible combination.

During World War II, the Germans had what they believed was an uncrackable encryption machine called the Enigma. The coded messages the Germans were sending to one another to the many battlefields in Europe were eventually deciphered by Englishman and Mathematician Alan Turing through a fatal flaw in the way the messages were coded. Learn more about it here.

Today, we rely more so on software rather than hardware to make encryption difficult to crack. And it’s important that we do it right because everything from accessing websites where sensitive information is stored, to the messages we text each other through Whatsapp, to even blockchain technology, and bitcoin relies on encryption and cryptography to make sure what we do is safe and secure from those pesky third party adversaries.

Cryptographic security is the building block of, well, blockchain. Without cryptography we wouldn’t have bitcoin and the security and anonymity it provides.

Why is this?

Well, the way cryptography relates to bitcoin is in two ways. The first is through the use of the 1:1 ratio of a public and private key. Each bitcoin wallet is associated with one public key and one private key. For example, if you bought your bitcoin on Coinbase then the wallet your bitcoin is stored in also has a private and public key associated with it. If you have a Coinbase account then you don’t actually know your own private key. Coinbase does, and its attached to your wallet. But trust me, it’s there and its linked to your wallet. Without this private key, you wouldn’t be able to send your bitcoin to anyone else because you wouldn’t be able to prove that the bitcoin is actually yours.

See, unlike in the normal financial system where people have checking and savings accounts to store their hard earned cash, in the bitcoin network it doesn’t really work like this. For the checking and savings account to work, your bank needs to verify you identity in order to be able to keep your money on their centralized servers. They ultimately have to prove you are who you say you are and when they do, then the bank can agree that this money belongs to you.

On the bitcoin network, your bitcoin isn’t “stored” in an single place. It’s widely known that the bitcoin you own belong to you because of your private key.

This leads me into the second way cryptography is vital to bitcoin and that is through the use of one-way functions. In essence, these are mathematical functions that cannot be solved backwards to solve for the input if only given the output. In this case, your private key is the input and your public key is the output. Everyone on the network knows your public key (its string of numbers and letters) but only your wallet (you) know your private key.

The bitcoin network employs these one way functions to prove to the network that your private key, when imputed into the one-way mathematical function produces your public key. If it does, viola! You have proved to everyone on the network that you are the rightful owner of the bitcoin you are trying to send. If it doesn’t, the system will reject the transaction. More on these one-way mathematical functions here, and here!

Cryptography is an important part of bitcoin because it is what allows the transactions to be secure and anonymous. No one in the system knows who is sending money to who, but they do know it must be coming from whoever is the rightful owner of that bitcoin. It’s proved through the use of those one-way functions.

We hope you found this post educational. If you have any further questions, please reach out to us at studyingcrypto@gmail.com!

Until next time! For now, please enjoy this video on Cryptocurrencies with John Oliver!