The ultimate hitch-hikers guide to understanding technologies which enable cryptocurrencies and blockchain’s to exist.
Country — so much meaning and interpretation
When you say ‘country’, lot’s of things could come into your mind. One could be the people living within it and the culture of those people, other factors you might consider could be the economy which it is running on, the law’s that are written and obeyed, the government which is in place, the history of it being created, the education is provides. More, more and more. The point is the word ‘country’ is a very juicy and rich word. With so much meaning and application behind it. The word ‘Blockchain’ is the same.
When you say ‘Blockchain’, some might think of cryptography, or algorithms, others about hashes, distributed systems, cryptoeconomics, or, unfortunately, making easy money and buying lambos.
Just like a country which has so many things which come together and enable it to function properly, for people to live well within it. Blockchains have all these different elements, technologies, innovations which come together and allow for a it to function properly, enabling people to interact with the decentralized application (dapp).
The combination of these systems allow for blockchain to work, without one or the other, dapp’s would not be able to exist. Let’s identify them.
Start with the elephant in the room — Cryptography
In greek “kryptos” meant secret and “graphein” meant write. Put them together it’s ‘secret writing’. Cryptography is about making the messages or data into gibberish so that nobody can intercept them and use them. Cryptography is used everywhere, from your web traffic HTTPS, to wireless traffic 802.11i, WPA2, GSM, and Bluetooth. Cryptography is used to encrypt files on disks EFS, TrueCrypt, and much much more applications.
But Cryptography is not new. It has used since Romans. Julius Caesar used to encrypt his messages by writing them 3 letters ahead in the alphabet.
Symmetric Encryption System
One of the popular encryption systems is the symmetric encryption system. Symmetric system allows for parties to interact with each other and encrypting their messages so that they could not be discovered and understood by attackers.
Say Mark and Kevin are trying to send a message to one another using symmetric encryption.
They both share a secret key (k), which the attacker is unaware of . They will use a cipher (E,D).
When Mark is sending the message to Kevin he will use the encryption algorithm. When Kevin receives the message, he will use the Decryption algorithm.
Mark takes the text, m. Encrypts it, E(m). Creates a private key for that encrypted text, E(k,m). And then creates a cipher text out of it, E(k,m)=c.
Mark does E(k,m)=c
Kevin on the other hand, takes the cipher text — c. Uses the decrypting algorithm and his private key which he got from Mark — D(k,c). With this he generates the original text that Mark wanted to send in the first place — D(k,c)=m.
Kevin does D(k,c)=m
The encryption algorithm that Mark and Kevin use is publicly known, the only thing that is not open to the public is the private key.
One problem of Symmetric encryption is that the original private key needs to be shared between all parties receiving the message and if it will be intercepted by an attacker, that attacked has the power to read and understand all the messages sent. It is not that secure in that regard.
This Encryption methods is quite different. Every user has their own public key and private key. In order to send messages to parties you would need to use their public key’s to encrypt the messages and they would use their private keys to decrypt them.
Mark wants to send a message to Kevin (m). Mark would get Kevin’s public key and encrypt the message (pk). Then send it. Now even Mark is not able to decrypt the message, only the person with the private key of the public key which was used to encrypt the message is able to, in this case Kevin.
Mark does E(pk, m)=c
Kevin takes his private key, sk. And decrypts, D, the message. Done.
Kevin does D(sk,c)=m
Here is an interesting implementation of Asymmetric Encryption system, Digital Signatures, which rely on public and private key cryptography as well.
In the case of blockchain’s, one of the way’s translations are validated is through the use of digital signatures, were the person who made the transaction will make a signature next to the transaction to confirm that it was indeed him to did the transaction.
But these digital signatures cannot be copied and pasted, because unlike hand written signatures they change every single time you sign a different transaction. Producing a signature requires a function that relies on the message itself and on your private key.
You would take your private key, combine it with a message, and that would create your signature.
(Message, Secret Key) = Signature
In order to verify you would use the function that requires the message to be combined with the signature and your public key. That function would then determine if the you actually singed the transaction with a simple True of False response.
(Message, Signature, Public Key) = True/False Validation
There are many other cool uses of Crypto, like;
- Digital Signatures
- Anonymous communication
- Anonymous digital cash
- Private Auctions
The Crypto ‘Manifesto’ goes like this:
“Anything that can be done with trusted authority can also be done without.”
The Nitty Gritty Hashes
Hash functions are outputs of a bunch of numbers that map an input to an output. Hashes have many use-cases from storing passwords, to identifying files, to partioning data. But in the case of crypto, the most popular term you will hear is ‘Cryptographic hash functions’.
Cryptographic Hash Functions (CHF’s)
In essence, CHF’s take in any size text/data and give out a fixed output of numbers.
CHF’s have the following properties that make them secure:
- An input of any seize will produce an output with a fixed size.
This means that whatever you put in as your text/data, whether it being a single symbol, word, or sentence, or it being a huge essay, collection of transactions, or anything else. Whatever it is, it will still have the same size hash function. This prevents people from guessing the input based on the output.
2. The same input will always produce the same hash.
And any small changes in the input will produce a completely different hash.
3. It is computationally infeasible for someone to figure out the input based on the output hash.
If you think you can do this you might as well just go and play the lottery.
4. It is very difficult to find two inputs that would produce the same output.
Go play the lottery one more time.
The Almighty Algorithms
You hear the word ‘algorithm’ constantly, but many do not realize what an algorithm actually is. Algorithm is a procedure or formula for solving a problem. Just like cryptography which has been existing since the Greek and Roman era, algorithms have been around for over 4000 years, with the first once being used back in 2000 BC in Mesopotamia.
Dr Pano Parpas, lecturer in the quantitative analysis and decision science section of the department of computing at Imperial College London, explains algorithms very well:
“There are lots of types, but algorithms, explained simply, follow a series of instructions to solve a problem. It’s a bit like how a recipe helps you bake a cake. Instead of having generic flour or a generic oven temperature, the algorithm will try a range of variations to produce the best cake possible form the options and permutation available.”
Achieving Peace & Harmony through Consensus Algorithm
Since decentralized networks do not have a central third party through which trust can be established, the establishment of trust is supported by a consensus algorithm between the nodes which are a part of the network. A consensus algorithm is a process used to achieve agreement on a single data value among distributed processes or systems.
A good Consensus Algorithm needs to have a fault-tolerance in order to deal with wrong-doers in the network.
They need to include:
- Deciding whether to commit a distributed transaction to a database.
- Designating node as a leader for some distributed task.
- Synchronizing state machine replicas and ensuring consistency among them.
There are many many consensus algorithms, here is list of some that exist: Proof of Work, Proof of Stake, Delegated Proof of Stake, Proof of Importance, Proof of Authority, Proof of Capacity, Proof of Burn, Proof of Activity, Proof of Existence, Proof of Weight, Proof of Elapsed Time, Proof of Believability, Proof of Service, Proof of Contribution, Byzantine Fault Tolerance, Delegated Byzantine Fault Tolerance, DAG’s. The point is there are a LOT.
I’ll give a brief overview of the most popular once you hear in the crypto industry; Proof of Work, and Proof of Stake.
Proof of Work
This one you are likely to hear the most in the crypto industry since the most popular mainstream use-case of blockchain, Bitcoin, employs this method.
The PoW is the method bringing trust to the network for unknown nodes to interact with one another and grow, expand the blockchain.
PoW system relies on a group of nodes which are labeled ‘Miners’ which work on finding a cryptographic hash function which starts with a certain amount of zero’s. They do this by running lots of guess’n-checks with the computer system.
As previously explained, a small change in the block will cause a huge different number hash, it’s literally a lottery game of about 1 in a billion chances for a node to guess a write number which would allow for the block to have the hash that starts with a certain number of zero’s.
Once the miners run through this long and intense computation they can display that and add it to the block, giving them the reward for extending the blockchain.
In order to check if the cryptographic hash function is actually valid, all you have to do is take the number with which the miner guesses the next hash function, and apply it, seeing if that number truly does give a certain hash. If it does, then that miner is not fraudulent and should be rewarded his long and deserved Bitcoins. Therefore the system requires a large amount of computational work and energy to perform, but it is relevantly easy to check and validate.
Andreas Antonopoulos, a blockchain expert and bitcoin evangelist, put it very nicely;
“Proof of Work provides security from an investment of energy.”
Just as a side note, PoW is not new. Satoshi did not invent it with Bitcoin. PoW idea was originally published by Cynthia Dwork and Moni Naor back in 1993, but was coined by Markus Jakobsson and Ari Juels in a document published in 1999.
Proof of Stake
PofS is very popular among the crypto community as well, with Ethereum trying to transition to that consensus algorithm instead of Proof of Work. This consensus algorithm acts quite differently. Instead of ‘miners’ in the blockchain trying to find hashes, verifying transactions and expending the network, you have ‘validators’.
In PofS you do not have a huge investment of energy trying ‘win the lottery’, instead you have nodes which have to repost or deposit a certain amount of coins into the network as stake. The bigger the validator stakes, the more chances they have to be chosen by the network to validate the next block.
A node who is chosen as the validator has to check if al the transactions within are indeed valid. If everything checks out, the nodes signs off on the block and adds it to the blockchain. The incentive of PoS is the validators receive the fees which are associated with each transaction.
If the validators are fraudulent they will lose a part of their stake. To ensure that validators don’t approve larger sums of transactions and be fraudulent, the stake which they place has to be higher then whatever they would receive from the transaction fee. It wouldn’t make sense for them to cheat because they would lose more money then they would gain.
The Great Incentivizer — CryptoEconomics
To give a brief overview of CryptoEconomics, it is an area of applied cryptography that takes economic incentives and economic theory into account.
We’ve previously encountered an example of economic incentive in the network, with miners. How they are rewarded Bitcoin, or Ether for solving complex mathematical problems and finding a hash that has a certain number of zero’s
Cryptoeconomics uses incentives and cryptography to design systems, applications and networks. A well-known blockchain which utilized CryptoEconomics quite well, is of Bitcoin. Satoshi created digital scarcity with Bitcoin.
CryptoEconomics factors of Bitcoin:
- Only 21 million Bitcoin’s can ever be released into the network.
- At first the miner of new blocks would be rewarded with 50 BTC’s. That number splits every 4 years. To 25, to 12.5, to 6.25, and so on until all the Bitcoins are mined.
- As time passes, the hash difficulty will increase and it will become more difficult to mine new blocks and therefore receive new Bitcoins as the result.
- A new block get’s added to the blockchain every 10 minutes, and it is estimated that it can only manage about 7 transactions.
- The last Bitcoin will be mined in 2140
The Hybrid Technology
As stated in the beginning, Blockchain is such a pact word, with so much meaning to it. But in order to use the application on it you do not need to know all these definitions and applications. Just like when you use the internet, you do not need to know how HTTP files are put in a search algorithm based on the most relevant once to your search input.
Blockchain consists of a lot of stuff. Learn it if you truly want to understand this technology. This covered the obvious elements, but there are a few that I missed like Distributed Systems, Byzantine Generals Problem, HyperLedgers, Tokens, and more. But please when you talk about Blockchain do not think about just Lambos and Bitcoin. There is so much more.
The Hybrid Technology was originally published in Good Audience on Medium, where people are continuing the conversation by highlighting and responding to this story.