The Tech Behind Blockchains
Welcome there courageous wanderer of Mount Blockchain. I’m delighted that you’ve made it here to blockwhat?.
After we have thoroughly explored the history predating the advent of blockchain, we’re now ready to delve right into the mesmerizing technology that makes this new paradigm shifting invention work under its hood.
This post will give you an overview as to what will be covered as part of the series on the Technological Foundations, why it matters and then provide a brief introduction into the different technological aspects.
Ready? Then let’s get started!
This is our roadmap for the next couple of posts:
- The Tech Behind Blockchain (This article)
- A Journey Into Decentralization
- Hash(ing) Everywhere — A Primer On Hash Functions
- Public Key Encryption — A Comprehensive Guide
- Merkle Trees — Ensuring Integrity On Blockchains
- Finding Consensus 1/4: Byzantine Fault Tolerance
- Finding Consensus 2/4: Proof of Work
- Finding Consensus 3/4: Proof Of Stake
- Finding Consensus 4/4: Alternative Consensus Mechanisms
- Network — Who’s Doing All This Stuff?
What’s this all about?
Before we start, it is very important to clarify the terminology used throughout these posts. The word blockchain has become ubiquitous and is thrown around a lot recently — yet, there isn’t just one type of blockchain, but rather many different concepts and ideas that all fall under the umbrella that is blockchain.
Nevertheless, we will explore the most essential building blocks (pun intended) of this fascinating new technology and go in-depth into Bitcoin and Ethereum, the two behemoths which are at the core of many other blockchain projects.
While this series on The Tech Behind Blockchain will cover the technological aspects powering this new paradigm, we will also get to know the people who are behind the different technologies, their convictions and motivation.
It can get very technical at points, but please don’t be intimidated by that — it’s nothing from out of this world and once you understand the concepts and tools that make up the motor of blockchain technology, you will be able to lead a way more nuanced and fact-based discussion than before.
Actually knowing what others and foremost you are actually talking about.
As a disclaimer, I don’t have technical background myself, what I’ve learned and what I know is through extensive reading of countless articles, books, podcasts, meet-ups and super interesting people. While I was researching my bachelor thesis, I realized that there is a never ending supply of information surrounding blockchain online — yet it was too much at times and too dispersed. Either it was too technical or it was too superficial — rarely something in between.
This is the main motivation why I decided to start this blog — to offer curious people like you one centralized (pun intended) place to find the most important things to understand what’s going on in this cryptic blockchain space.
Without further ado, let’s see what we will cover during the next couple of posts!
The Tech Behind Blockchain
In this section we will briefly explore the different technological aspects that are under the hood of Bitcoin, Ethereum and many other blockchains that are inspired by these two.
The key characteristics that make all these blockchains so unique and provide them with a truly groundbreaking potential, are the following:
First and foremost, they constitute an extraordinary way of establishing truth (or a commonly accepted version of it). While we traditionally relied upon centralized authorities to achieve this feat (think governments for identification and banks for money), now we have a system in which consensus can be found without a central authority.
The data that is established as the truth is stored in a cryptographic way that ensures it is immutable (not changeable), as well as ensuring a high degree of transparency and audibility.
Since all of this is done in a distributed and decentralized fashion, the system has a very high redundancy. On top of all this, the blockchains that we will focus on in this series are permissionless, which means that everybody can easily participate in the network without having to ask anybody for permission.
There are other types of blockchain designs, such as private or permissioned ones, but these will be covered in a later article.
Let’s explore the different building blocks that make all of these characteristics possible!
The Basics
We’ll begin by taking a very brief look at cryptography. This science is essential to the functioning of blockchains and is basically the practice of securing communication in the presence of malicious third parties.
Cryptography plays an important role in blockchain technology as it allows for digital fingerprints, digital signatures and an overall cryptographic-proof security model. Ironically, encryption so far is not an important part of the technology, as communication and transaction data are currently not typically encrypted and do not need to be in order to ensure a reliable and secure system.
We will go more into specifics in the subsequent posts, so for now this shall suffice.
Before we look at the different technologies that make the system work, we will start with an overview of how a blockchain as in the case of Bitcoin and Ethereum is actually created — literally the process of linking the different blocks together to form a chain.
First, all transactions/all data is recorded during a certain amount of time and then pooled together. There are of so-called miners who do this job of keeping track and each one of them collects all the viable transactions into a block. While they are all busy keeping track, they also simultaneously compete to solve a cryptographic puzzle.
The first one to solve the puzzle then broadcasts his block to the network, which verifies the accuracy and integrity of all the transactions included and the block itself. If validated, the block is then cryptographically linked to the public ledger. This process is illustrated below, in this case for a Bitcoin transaction.
If this seems somewhat obscure and confusing, don’t despair, we’ll get through this together and in the end you’ll walk away with a fundamental understanding of this technological marvel!
In the subsequent sections we’ll explore the most important aspects that we will cover in this series on the technological foundations.
Decentralization
Decentralization is a word that seems to be everywhere lately and which is at the heart of the blockchain revolution. In the case of blockchains it is important to point out, that there is an important distinction to be made between decentralized and distributed.
Decentralized systems are a special subset of distributed systems. In short, in a decentralized system all the work is done by the different parts of the system and the decisions are never made by a centralized and single entity — in contrast, a distributed system can work (process) data on many different computers but decisions can still be made in a centralized fashion.
Hmm, ok. But what exactly is so special and important about this characteristic?
Well, there are three major reasons for a decentralized design.
The first one is fault tolerance. Fault tolerance is achieved by a diversification of system components, meaning that the whole system won’t slow to a halt or break down completely if a single part fails.
The second is is attack resistance. Attack resistance is given since it is more expensive to attack a system without a single point of failure — the more parts a system have that need to be successfully attacked, the more expensive it gets.
The third reason is collusion resistance. Collusion resistance results from the difficulty to behave in self benefitting ways, this is also known as the free rider problem and described in greater detail in this article about Prof. Emin Gün Sirer.
So far so good, let’s move on to hashing now.
Hashing
Hashing is a mathematical process to encode and compress data. It plays a fundamental role in the way blockchains function and guarantees security.
The two most important hashing algorithms used are SHA-256 and Keccak256, for Bitcoin and Ethereum respectively. These two are so called cryptographic hash functions, which possess certain special properties and characteristics (which we will delve into more in the respective article for hashing!).
A hashing algorithm takes an input (this can be literally anything), runs it through some magic mathematical processes and then creates a unique output. Just for fun, let’s go through this process and create a hash of the sentence “Most of the time travellers worry about their luggage.”
SHA-256 hash:
55D0EFF51767341750B8FAB75244CB884310452916D17EA877B43AE16F468B6B
What’s very important and special about these hashing algorithms is, that the tiniest change in the input completely alters the output! For example, if we repeat the same process explained above and add a comma to the sentence “Most of the time, travellers worry about their luggage.”, we get something completely different.
SHA-256 hash:
5D19B0D0BC503AAABC02D41F2678DFF069F169FA432E0FC29117B067562A993C
As you can easily see, it is almost impossible to calculate the hash from the second sentence by looking at the first hash. The only way to correctly get the corresponding hash, is by hashing the two sentences individually. These type of mathematical problems are really easy to compute into one direction, but not into the other. And they’re super easy to verify.
Public Key Cryptography
Public key cryptography is a technique that was developed in the 1970s and enabled a revolutionary new approach to the way secret messages could be sent. Ever since then, this technology has been an important mathematical foundation for information and computer security.
The mathematical functions used in Public Key Cryptography have the unique characteristic that they are almost irreversible, meaning that they can only easily be calculated into one direction and not the opposing one. This enables the creation of unforgeable digital signatures and digital secrets. (More on this in the next section)
Let’s take a brief look at how this magic work:
We start by taking a random string of numbers (e.g. 3860280357), from now on this will be called our private key) and mathematically derive another string of numbers from it — the resulting new string of numbers is called public key. A very important aspect of this process is, that it’s a so called one way function, which means that it’s very easy to calculate it into one direction (ergo from private key to public key), but not the other way around (aka it’s almost impossible to derive the private key from the public key)! The main take away that you need to remember and understand right now, is that these two keys share an intimate relation and are linked to each other.
This very abstract sounding concept enables us to do some marvelous things though, because we can now take a piece of data, use our public key and scramble it up (by using some encryption magic). For everybody out there this new data set is incomprehensible and unreadable. In order to unscramble it and to make it readable, one need to be in possession of the corresponding private key. Whoever has that key, can now use some mathematical magic and unscramble the data. Voila!
Digital Signatures
Digital signatures are at the core of how transactions work and can take place on a blockchain. They are used as a mathematical scheme to prove the authenticity of a digital message, meaning that they prove ownership of a private key without revealing that private key. Crazy stuff!
This concept serves three purposes within Bitcoin and Ethereum. Firstly, it authenticates that the owner of the data has authorized the transaction to take place. Secondly, it shows that the sender cannot deny having sent the message, thus proves nonrepudiation. And thirdly, it ensures that the transaction or message has not been altered and cannot be modified.
Above you have a lovely visualization of how this works.
Let’s move on to trees of another kind.
Merkle Trees
One of the most essential concept employed by blockchains are the so-called Merkle trees. It’s not by accident that they have a close relation in name to their natural relatives — there structure resembles the roots that all taken together give form and enable the trunk above.
So what exactly are merkle trees?
Well, merkle trees are an efficient way of efficiently summarizing large sets of data and verifying their integrity.
Therefore they possess some critical features that are of utmost importance for blockchain technology. The ability to verify whether a certain transaction is included in a specific block is fundamental, since computers do not need to have knowledge of the entire transaction history.
This saves a lot of space and computing power.
If you want to deep dive into this fascinating aspect, go right ahead:
Consensus Mechanism
This aspect is at the very heart of the groundbreaking potential of blockchain technology and is a truly ingenious feat.
Satoshi Nakamoto’s main invention is arguably the decentralized mechanism for emergent consensus within a decentralized system.
Why is that such a big deal?
I’m sure by now you’ve stumbled upon the fancy words Byzantine Generals Problem somewhere in the vast blockchain space.
Satoshi found a groundbreaking and mesmerizing solution this old problem (there will be a full length article about this soon). This problem describes the great challenge to coordinate resources among different participants and to find consensus. The problem is often described as a group of Byzantine generals who all besiege a city. Only if they attack at the same time, they will be able do win the battle — the only problem is that they need to find a way of how to trust each other to attack in a coordinated manner.
Bitcoin managed to achieve Byzantine Fault Tolerance and solved this problem elegantly. It does so by using a marvelous consensus mechanism known as Proof of Work (PoW).
Proof-of-Work is the most commonly adopted consensus algorithm and is used both by Bitcoin and Ethereum. It constitutes a cryptographic puzzle, which competing mining nodes try to solve. In order for a competing mining node to win the right to broadcast their block into the network and thus gain the newly created coins and the accumulated transaction fees, the node needs to hash the block header repeatedly, changing one parameter at the time. They are basically guessing the possible solutions.
Why all this hassle you might ask yourself?
Well, this guessing is using a lot of computational power. And this computational power needs energy. Energy that you need to pay for. Therefore, by proving that you worked hard to find a solution and were willing to pay for it, you eventually at some point get rewarded big time: the one who finds the correct solution for the puzzle gets a reward (currently 12,5 Bitcoin) plus the transaction fees (that the other people have to pay in order to have their transactions be conducted).
All the blocks that have been linked together are a testament to all the work that went into finding them. If you’d want to change something in a past block, you’d need to redo all the work that has been conducted afterwards!
While Proof of Work is the most widely used consensus algorithm, there are many other forms.
One famous alternative is Proof of Stake. The Proof-of-Stake algorithm determines each user’s right to validate the unconfirmed transactions depending on their stake in the system, measured by the quantity of native coins that they respectively hold. Thus the participating validators are supposed to be disincentivized to corrupt the ledger since it is vital to the value of their own assets.
You can check out the other parts of the mini-series on finding consensus right here:
Network
Blockchains are comprised of a lot of different parts that together form a unique and powerful network.
In the case of Bitcoin and Ethereum we have a couple of different types of so called nodes — computers that run specific software that makes the blockchains run smoothly.
There are for example full nodes, who have the full software package downloaded, keep a complete version of the blockchain and participate in the mining process.
Then you have lightweight nodes, which do not take part in the mining and simply are used to interact with the blockchain and make transactions — wallet applications are a typical example of this.
You also have mining nodes which are, normally, highly specialized computer hardware bundles that are build for the specific task of partaking in the cryptographic puzzle and to guess as many hashes as possible.
And last but not least we have pool protocol servers, which bundle together many different individual miners who each by themselves don’t have sufficient computing power to successfully participate in the mining process. In these pools they put all their processing power together and share the profits.
So far, so good. All the components that we’ve briefly touched in the article above work together to make blockchains work and thus enable this awesome new paradigm.
I hope this post gave you a good introduction and overview over what’s to come and has you excited to continue your journey of understanding blockchain.
If you have any questions, comments or remarks, please feel free to let me know!
All the best
Till
PS: If you’re looking for helpful and great resources to learn more about blockchain’s paradigm shifting technological potential, check out these awesome resources.