Nowadays there has been a lot of buzz around cryptocurrencies and blockchain. This has in part helped by the record breaking prices of Bitcoin and Ethereum. According to google trends report, the interest in blockchain is as high as ever:
There are those who are putting in money into initial coin offering(ICO) in hopes of hitting the next big jackpot. Then there are those who want to use the innovation called “blockchain” in different implementations.
Blockchain offers a world of opportunities in our hyper connected world. But there seems to a be general confusion around the technology. Over the years, I have been always interested in learning the technological aspect of crypto currencies. I have always found the articles online to be too technical or abstract to make sense of things. Please follow along my journey as I understand each part of the crypto currency phenomena. The content has been formatted to look at one question at a time.
What is cryptocurrency?
As per Wikipedia: A cryptocurrency (or crypto currency) is a digital asset designed to work as a medium of exchange using cryptography to secure the transactions and to control the creation of additional units of the currency.
Let’s breakdown the definition even more:
Asset by definition is something we own and have rights to use. Example, a house is a physical asset. A digital asset is something which exist digitally on a computer. A good example will be your last vacation pics. Those are owned by you and are your digital asset.
Medium of exchange is something which can be used to trade. Example, the money in your wallet is a medium of exchange. You can exchange it to get a burger, a car ride or even the house which turns into asset later.
Cryptography in pure layman terms is study of hiding information. A good example will be finding a way to securing your facebook password. Cryptography will be utilized in finding the best possible way to hide the password from people wanting to hack it.
Now when we talk about a digital asset – think of your vacation photos. I can create copies of them by simply doing copy and paste. This means a digital asset potentially can be generated as and when we want – simple copy and paste. Cryptocurrenies ensure additional coin cannot be created on a whim.
So in total, it is something which is cryptographically secured and can act like money or currency. Hence, the moniker “cryptocurrency”.
What types of Cryptocurrencies and blockchains are there?
By last estimate there were over 840 different coins. Some of them defunct while others with negligible value. If you talk to someone who is into the cryptocurrency scene, they will tell you there are two major currencies:
- Bitcoin – This was the first ever cryptocurrency to be implemented back in 2008 by Satoshi Nakamoto. The innovative technology of blockchain was introduced along with bitcoin.
- Ethereum – As years passed by people found blockchain could go beyond it’s original intended purposes. It lead to coins like Storj – decentralised storage using blockchain etc. Each of the coins catered to a single purpose. Ethereum was introduced back in 2015 to make it easier for people to utilize blockchain technology for whatever purpose they saw fit using “smart contracts”.
Confused? Have tons of questions like:
How does one own it?
How does one spend it?
What does cryptographically securing transaction mean?
How are coins generated?
Let’s look at this one step at a time. First step:
The very first challenge in digital money is – ownership. It’s easy in case of government issued currency – If I hold the cash in hand, I was the owner. If it was a non-cash transaction then my signature on the cheque or card receipt can be used to verify the transaction.
How are digital currencies solving this? (note: words in italics are technical terms and highlighted as they are introduced)
Encryption is a way to ensure data or message can only be read by the intended recipient. While this doesn’t stop people from intercepting the message in between it ensures they cannot find out what the actual data/message is. Think of battle plans, whatsapp messages, your emails or even those snapchat pictures etc.
There are three parts to this – first the plaintext which is the original message. Then there is a key which is used to encrypt the message. Once the plaintext goes through encryption it becomes ciphertext. The process of deciphering the ciphertext back to the plaintext is known as decryption.
There are two types of encryption:
This was the very first form of encryption. It is called symmetric because encryption and decryption can be done via the same key. To understand this let’s look at an example:
The oldest known symmetric key is Caesar Cipher. The idea was to shift the alphabet by 3. So,
H = K
O = R
This is how encryption and decryption of a simple message flow will look like between two people – Mr. Red and Mr. Green:
As you can see both encryption and decryption requires the same key.
2. Asymmetric encryption
If you understand the nature of symmetric encryption, this shouldn’t be a tough one to guess. Using the same key to encrypt and decrypt no longer works:
So how does it work really? By using public-key infrastructure (PKI).
In public key encryption, everyone generates one set of keys – private and public. The public key can be shared to the whole world, while the private key is known only to the owner. Now for a two way communication a key exchange needs to happen.
Let’s re-look at the above example to establish communication between Mr. Green and Mr. Red:
Step 1. Both of them create their own public and private key pairs
Step 2. Both of them need to have the other person’s public key. The sharing can be through publishing it outright to doing an exchange as shown here. Important – Private Keys are never shared.
Step 3. Now two-way communication can happen between Mr Red and Mr Green. Mr. Red can send message encrypted using Mr. Green’s public key. Mr. Green can decrypt the message using his own private key:
Similarly, Mr. Green can reply back using Mr. Red’s public key which can be decrypted using Red’s private key. Thereby establishing two-way communication.
The most important feature of public key encryption is that every public-private key pair is unique. You can think of this as unique as your own thumb print and the same feature is used to create digital signature
Going back to our example above – Suppose at some point Red doubts Green’s identity. So Red can ask Green to prove it. Green does this by writing a message and sending it along with a signature generated using the private key. Once Red receives the message, he can then use the public key on the message and verify the identity:
This same idea is utilized by crypto currencies to ensure ownership.
Whenever you download a wallet, the first thing you notice is it gives you a string of numbers and alphabets also known as your address. This is where your digital coins are stored. The address is the public key portion of PKI and can be shared with anyone. People are only associated with their public key which ensures anonymity.
There is also a private key generated by the wallet. It helps to prove your ownership of the coins via digital signature.
Pro-tip 1: Never share your private key with anyone. This is very important as you can lose control of your coins.
A good example of this happened back in 2013. Matt Miller on Bloomberg bought a physical bitcoin card. He unintentionally showed the private key on live TV. The coins were stolen from his wallet. Video here:
Pro-tip 2: Always secure your private key using a strong password. It ensures an extra layer of protection. Even if someone hacks your computer they will be unable to use the private key.
Expanding on ownership, let’s look at an advanced feature provided by crypto currencies – Multiple-Signatures or Mutli-Sig.
We understand from above that a digital signature can be generated from a public-private key pair – 1 private key for 1 public key. In multisig, the pairing goes beyond the 1:1. It changes the equation to multiple private keys mapped to a single public key. Furthermore, a rule can be made on how many private keys are required to generate a valid signature.
Let us go back to our example, Green runs a business with his partner Blue. A key paired created is of type 2 out of 2. Then while interacting with Red, the only way to generate a valid signature requires both Green and Blue private key too. If the signature is generated by only one of them, the signature is invalid:
To take this further, if there is a new business partner Yellow, a new pair can be generated with 3 out of 3 rule. So, unless all three sign there is no way to generate a valid signature.
Or if Yellow is a silent partner not involved in day to day operations, a key with 2 out of 3 rule can be created. In this case Yellow’s key can be used if either of Blue or Green are unavailable to sign.
The important point here is the combination can be anything we want. So, we can do –
3 out 5 – 3 keys required out of 5
2 out 5 – 2 keys required out of 5
7 out of 10 – 7 keys required out of 10
Now that we have resolved the ownership problem, here’s the second one – While the public key infrastructure (PKI) works for two-way communication. How do we ensure mass communication between people for currency transactions? We will cover this aspect in part 2.
PS: If there are any doubts on this post, please leave a comment I will try and answer them in my next post.
Also published on Medium.