A beginner’s guide to blockchain cryptography
Cryptocurrency was the top ranked tech Google search of 2018. This should come as no surprise because Bitcoin, the first and most well-known cryptocurrency, took off around 2015. With its meteoric rise, the hype of blockchain technology followed suit.
Blockchain is the underlying concept and framework that Bitcoin is built upon. As opposed to being dependent on a centralized system, such as using banks, social media companies, and cloud storage, blockchain is a decentralized system that leverages a distributed ledger of record keeping. This 2-minute video produced by the U.S. Treasury gives a great overview of blockchain.
In short, the defining features of blockchain that make it an enabler for innovations like cryptocurrency are that it’s distributed, decentralized, append-only, consensus-based, and perhaps most critically, secured by cryptography.
If blockchain is cryptocurrency’s underlying skeletal system, then cryptography is its nervous system — it enables information and identity to be securely exchanged between actors throughout a broad network. Cryptography is a vast field of applied mathematics, and in order to distill how it works and connect its importance to blockchain applications within a few paragraphs, I’ll develop an analogy to a classic social game.
Imagine playing the broken telephone game…
There are a few problems associated with this:
- The original message has changed
- The receiver doesn’t know that the message has changed
- The receiver doesn’t know if the message came from the expected sender
In order to solve these issues, blockchain cryptography utilizes a digital signature (like a seal on the package) to verify and authenticate the transactions on the network.
The digital signature achieves the following purpose:
- Ensures that the message has not been tampered with
- Provides verification that it is the correct person who signed the paper (transaction)
- No one else has forged or copied the signature
- Once signed, the signature cannot be repudiated
How does the digital signature work?
To apply cryptography in the scenario of the telephone game, if person A wants to send message “peas” to person B, he/she would use a private key to “lock” the message. Locking the message here means encrypting the message with asymmetric cryptography.
Asymmetric cryptography uses a pair of public and private keys that are arithmetically paired but not identical. The public key can be shared with everyone, but the private key in the pair is kept secret. One key from the pair is used to lock the message, and only the opposite key can be used to unlock the message.
The best analogy I’ve heard describing this process is like turning a chicken into chicken nuggets- it cannot be reversed to figure out the original message. Person A’s message then turns into a set of random letters, represented as the secret message in the above illustration because the random letters do not make literal sense.
As illustrated, signing the message with the person’s unique private key creates the digital signature.
Sending the message
When person A is ready to share the message, he/she will send the original message, the public key(the other pair to the private key) and the digital signature as a package to the targeted receiver, person B.
Receiving the message
When person B receives and opens the package, he/she would take the public message from person A and run it through the same cryptography function to get the secret message. Person B keeps this secret message for verification purpose later.
Then person B will take the public key and the digital signature from person A, and run those through a cryptography verification function to get the secret message that’s embedded within the digital signature. Since the private and public keys are arithmetically paired, anyone else’s public key will not be able to unlock the sender’s digital signature.
Now, the receiver, B has both secret messages- one encrypted from the cryptography function, and one unlocked from the digital signature. He/she can compare if they are the same.
Again, we are not comparing the original message here because the chicken nuggets cannot be transformed back to the chicken. If both secret messages are the same, then the receiver knows the message and the sender are verified as intended. Otherwise, the receiver knows somewhere along that process, something has been changed.
I hope my attempt to simplify the blockchain cryptography concept provides a helpful overview for understanding this technology.
Thanks for reading!