What is Blockchain? Consensus, Cryptography and Crypto Economics

[Part 3] What is Consensus, Cryptography and Crypto Economics in Blockchain?

A network of nodes that synchronize over the latest state of a ledger

I know we covered a lot of ground already, let’s revisit briefly what we learned in Part 1 and Part 2.

The blockchain is a network of accountants called nodes. The nodes keep track of identical copies of a ledger. The ledger consists of transactions bundled in blocks. The blocks are linked together, forming a chain – blockchain.

There is no central node in the network, and all the nodes are equal. They all relay each other information about the transactions happening and synchronize with each other. This communication process is called gossiping.

The goal of the network is to reach an agreement about the latest valid version of the ledger and synchronize their own copies in accordance with it. In this article, we will cover blockchain consensus, blockchain cryptography, and crypto-economics.

… reaching blockchain consensus about the latest state of the ledger

Consensus – a general agreement

Consensus is the act of reaching an agreement on a matter. Doing so is a natural thing for us – human beings. This is how we operate, how we navigate the social world, cooperate and prosper. Ranging from agreeing on what to have for breakfast with your spouse, to agreeing on location for a meeting, or even whether the AC should be on in the office, we are reaching consensus tens or even hundreds of times per day.

However, when it comes down to a network of tens of thousands of special computers the problem becomes much harder. Things like the physical time it takes them to communicate between them, the geographical proximity of some nodes to others, the rigidness of the rules they operate based on, all play their roles in complicating the process of reaching consensus.

Add to this the lack of a central authoritative point and the inherent human desire to “try to game the system” and reap benefits and you are now reaching consensus in blockchain becomes a daunting synchronization task.

A quick example of this desire would be, a malicious node vehemently denying that they’ve spent their balance, or claiming that in their books they actually have billion dollars. If the villain is able to persuade the rest of the network to reach a blockchain consensus that he actually has a billion dollars, he has gamed the system and profited from it.

In order for the network to fight this and reach blockchain consensus, a special procedure of steps needs to be followed. This procedure in the blockchain is commonly known as the consensus algorithm.

Consensus algoritm in blockchain

The blockchain consensus algorithm has two main goals. The obvious one is to achieve consensus over the latest state of the ledger. The second is to fight malicious behavior.

Puzzle piece 11: Consensus algorithm – procedure, consisting of a sequence of steps, that followed provides a way for the network to reach a blockchain consensus over the latest state of the ledger while fighting any malicious behavior in the network.

In order for these goals to be achieved two sets of techniques are used.

The first one is called cryptography – used to prove, mathematically, without a shadow of a doubt, who did what.

The second one is called crypto-economics – used to give incentives to the nodes to act correctly while giving disincentives to act maliciously.

Let’s try and see how these techniques work.

Blockchain Cryptography – the undeniable truth

Cryptography is the science of making a message readable for only the intended reader. All of this is achieved through concrete math. In order to show you how blockchain cryptography is applied, I have to take you back to ancient times.

The emperor’s communication problems

Imagine for a second, you are the head of the mighty Roman Empire. You’ve thousands of legions and each legion has it’s general. You’ve decided that you’d want to attack the mighty, but unsuspecting, Bulgarian khan.

As long as the Bulgarians are not suspecting, you are guaranteed success. However, if your plans are leaked and the Bulgarians are prepared, you are probably going to lose.

You are now facing two tasks:

  • You have to make sure that only the generals understand the message.
  • You have to make sure that even if the messenger is intercepted, the readers will not understand the message.

These are exactly the types of problems that blockchain cryptography deals with! Such problems exist all around us – sending secret emails, keeping the privacy of communication with your spouse, or even secretly submitting your tax report – the need for privacy in communication is even bigger in our days.

Puzzle piece 12: Cryptography – the mathematical discipline of making a message readable for only the intended reader.

Let’s see how the emperor has solved his problem.

blockchain cryptography

The emperor’s hidden messages

Before the start of the campaign, the emperor had a personal meeting with each general. In this meeting, the emperor told a secret number to each of his generals.

The secret number for the general that would be attacking the Bulgarians is 1. When the time comes to attack, the emperor sends the general the following message:

“buubdl”

I know it does not make sense – this is a good sign, so bear with me. If this message does not make sense to you, it won’t make sense to the interceptor too, right? The attack message has been altered through a process called encryption. The new “gibberish” message is called cyphertext.

For the general, however, this message makes sense, as he has all the information needed, in order to perform the reverse process – decryption. Let’s see how the encryption and decryption are performed.

First of all, the emperor converts every letter in the word attack into its corresponding number in the English alphabet. A is 1, T is 20, C is 3, and K is 11 → 1, 20, 20, 1, 3, 11

Second, the emperor adds the secret number that he told the general to every character number → 2, 21, 21, 2, 4, 12

Third step is converting the numbers to letters again – 2 is B, 21 is U, 4 is D, 12 is L

The resulting message → “buubdl”.

The only thing the general needs to know in order to make sense of “buubdl” is the secret number. Knowing it, he can reverse the process (substracting 1 of every letter-number) and see the original message – “attack”.

What is Blockchain: Consensus, Cryptography and Crypto Economics

This is the simplest form of cryptography. Over the years more sophisticated ways of encryption and decryption have been developed (especially around the times of the world wars),. All of them share the same trait – they use a commonly know secret in order to encrypt and decrypt the message. The group of cryptographic algorithms that share these traits are commonly called – symmetric cryptographic algorithms.

Puzzle piece 13: Encryption is the process of producing “unreadable” cyphertext out of original meaningful message. Decryption is the process of reversing the cyphertext to its original meaningful message.

Puzzle piece 14: Symmetric cryptographic algorithms are the algorithms that hide the message using a shared secret between the sender and receiver. They are symmetric because both encryption and decryption are done with one and the same secret.

Symmetric cryptography, however, is not bulletproof and has one distinct disadvantage: What if the emperor and the general are never able to meet in person, in order to agree on the critical commonly known secret?

Asymmetric cryptography

The field of blockchain cryptography has another approach to situations, where it is impossible or impractical, for the sender and receiver of the hidden message to meet and exchange a common secret. This approach is called asymmetric cryptography.

It relies on the generation of a pair of special numbers, called keys. These keys can be used in two ways.

First, they can be used for encryption and decryption. Instead of using one and the same secret, for encrypting and decrypting the cyphertext, the asymmetric cryptographic algorithms use one key for encrypting the message, and another key for decrypting the message. Imagine it like a door that can only be locked with one key, but unlocked with another key.

These keys are special, huge numbers and the process for encrypting involves a significantly more complicated mathematical process than simple addition.

The key used for encryption is commonly known as a public key. This public key is not sensitive data and even if someone knows the public key, they cannot decrypt an already encrypted message (except if they try all the possible combinations of original messages in the universe, which would take an infinite amount of time).

The key used for decryption is commonly known as a private key. This key is very sensitive. If someone gets a hold of your private key, they will be able to read all messages intended for you.

Puzzle piece 15: Asymmetric cryptographic algorithms are the algorithms that hide the message using a pair of cryptographic keys. One of the keys, called public key, is used for encryption, and the other one is used for decryption (called private key).

Let’s see how the emperor and the general can use asymmetric blockchain cryptography to communicate without even having met.

Firstly, the general produces a public and private key pair. He broadcasts to the emperor his public key (and anyone else interested).

Second, the emperor encrypts the message “attack” using the public key of the general. For reference, the result will look something like this: AY6jMmmIw1ZYRwR9jiThQLNkzdEa5thnjCz4WitEpklvgGj7D8yex03lBt3Tslu/z6/MqqGGG3BzZCm9u/tyaA==

Pretty unreadable, huh?

Third, the general receives this cyphertext and decrypts it back to “attack”, using his private key.

Voila! The emperor and the general just communicated successfully without meeting to share a secret!

What is Blockchain: Consensus, Cryptography and Crypto Economics

Signatures

Remember how I told you that the key pairs actually serve two purposes. The second purpose of the keys is to act as a digital signature.

Through your keys, you can perform a mathematical process called “signing” – via your private key (the one that is only known to you). The signing process produces a text called signature. Then, again through the use of a mathematical process called “recovery”, anyone can calculate the corresponding public key of your key pair.

This process of sign-recovery can be used for proving that you’ve issued a certain message and disables anyone to be able to impersonate you (as no one knows your private key, thus cant produce a signature that can be reduced to your public key).

Well, how does this apply to the blockchain?

First of all, asymmetric cryptography applies to much more than the blockchain, it applies to the internet. This is how all your secure connections work. Your computer/phone and the computer/phone of your mate that you are chatting with, both have such keys. They are constantly encrypting the messages you send, in a way that is only readable by the intended receiver.

Your account on the blockchain

The pair of keys – public and private, in the blockchain is commonly known as (the very misleading term of) wallet.

Instead of your name, the nodes (accountants) record your balance against your public key number. If you try hard enough to be as abstract as possible, you can imagine that your “public key is holding your balance”. This is somewhat similar to your wallet holding your cash – thus the term wallet.

In addition, the nodes will only accept and process transactions that are spending a portion of your balance, if you produce a signature authorizing it. Remember – signatures can only be produced from your own private key, therefore no one can impersonate you and steal your balance. Again, if you try hard enough to be as abstract as possible, you can imagine your “private key spending your balance”. This is somewhat similar to you reaching into your wallet and spending your cash – another vague reason to call it wallet.

Lastly, in the blockchain space, you will commonly hear the term “address”. For the purpose of this read, assume that the address is just another synonym for your public key.

Puzzle piece 16: The term wallet actually means the public and private keys pair that you posses. Through the public one, also known as address, you are referred to in the ledger. Through the private one, you authorize transactions spending your balance.

Through cryptographic verifications, the nodes can always be sure (and be able to prove), that a certain user has/hasn’t performed a certain action. This is one of the major steps allowing for all the nodes in the network, to separately draw the same conclusion and results, therefore reach blockchain consensus.

Crypto-economy – the carrot and the stick

Although the blockchain cryptography does the heavy lifting in terms of being able to prove who is right and who is wrong, the process of applying it can be heavy, expensive and tiring.

At some point, if the work for the cryptographic operations performed becomes too complex or expensive, one can reason that the nodes would be better off not doing the validations they normally perform.

Here is where crypto-economy helps. Crypto-economy is the tweak of the consensus algorithm, where monetary incentives are given to the nodes that act correctly and guard the network, and monetary punishments are laid for those that fail to do so or even try to fraud the network.

Puzzle piece 17: Crypto-economy – a set of monetary incentives to act beneficially to the system and a set of monetary punishments if you are found to try fraud the system.

Up next – Consensus Algorithms

We already know enough about blockchain cryptography, consensus and crypto-economy. Every different blockchain consensus algorithm has its own set of incentives and disincentives. We will look into the different consensus algorithms in the next part.

 

 

I like it, I share it!