An Introduction to the Blockchain


The public ledger that is the secret sauce behind web3. What it is and why it’s so important.

notion image
Since a Blockchain is a series of blocks organised in a chain (bet you're glad you started reading this revolutionary stuff), this chapter is going to be organised in the same way.
Let's start with our first block...

Block 1: The Basics

notion image
We'll start with the example of signing up for Facebook. When you sign up with your name, email and any other information you need to provide, this data is stored in a database. That database is privately owned by Facebook. They decide what to do with your data. When you sign up, you are having to trust Facebook with your data. If Facebook is hacked, the hackers may be able to alter your data.
In contrast to this, a blockchain is a decentralised, distributed ledger. It's completely public. All entries to the ledger can be seen, and no one owns the information on the blockchain.
"Distributed" means that the current state of the ledger is replicated across many different machines. Together, those machines agree by consensus on what the current state of the ledger is and validate any changes being made. Blockchain networks are secured by cryptography. The idea is that the blockchain records information in such a way that it is very difficult to cheat or hack. Once some data has been recorded inside a blockchain, it becomes very difficult to change.

Block 2: Inside a Block

notion image
Each block contains some data, the hash of the block, and the hash of the previous block. A hash is like the fingerprint of a block. It identifies that block's contents and it is always unique. Changing the data inside the block will cause the hash to change. If the hash changes, that block is no longer the same block it was before.
notion image

Block 3: Creating a Chain

notion image
The third element we mentioned that goes into each block is the hash of the previous block. This is what is used to create a chain. Every block except the very first one points to a previous block. So what happens if you try to tamper with one block in the chain? The data inside it changes, so the hash changes. All of the following blocks in the chain are now invalid because they are pointing back to a hash that doesn't exist anymore.
What about the first block?
The first block is a little bit special, and the name for it is the Genesis Block or Block 0. It can't point back to a previous block because it is the first one in the chain. Every subsequent block in the chain can be traced back to this genesis block.

Block 4: Consensus Mechanisms

notion image
But hashes are not enough. Modern computers are very fast. They have the processing power to tamper with a block and then recalculate all of the blocks further down in the chain.  To protect against this, blockchains have consensus mechanisms. These are processes that slow down the creation and check the validity of a new block, before adding it to a chain. Before a block is added, over 50% of the validator nodes in the network have to agree that this block is valid. This makes it very hard to tamper with a blockchain.

Side Note: Nodes

These blocks of data we are discussing are stored on nodes. On a blockchain network, all nodes are connected, and they use these connections to continuously exchange the newest information with each other. Nodes can be any kind of device, but they are usually computers, laptops and servers.

Block 5: Adding a Block

notion image
When a new block is created, it is sent to everyone in the network. The validator nodes then verify the block, to make sure it hasn't been tampered with. The nodes agree on which blocks are valid and which aren't. Invalid blocks are rejected by all nodes in the network. If everything is okay, each node adds this block to its blockchain.

Block 6: Tamper Proof?

notion image
So to successfully hack a blockchain - these are the steps. Tamper with all the blocks on the blockchain, redo the hash calculation and the consensus mechanism process for each block, and then you need to somehow take control of over 50% of the nodes in the globally distributed network - so that the network accepts your tampered blocks. If you think about a large, global network like Bitcoin or Ethereum, this is a very, very difficult task.

Block 7: Smart Contracts

notion image
Smart contracts are programs stored on the blockchain. They can be used to automatically exchange data if certain conditions are met. The terms of the agreement between the parties involved in a smart contract are directly written into the code.
We get into this later but one example of a smart contract could be the use case of life insurance. In the event of someone passing, a death certificate could be the input needed to trigger the smart contract. Once the smart contract is triggered, it would automatically pay out funds to the beneficiaries named in the life insurance agreement.

Block 8: Uses

notion image
Digital currency may be where all the hype is. But those in the web3 world have much wider-ranging plans for the uses of blockchain technology. Blockchain technology and the highly secure, public chain of record it produces can be used for:
  • Fairer voting systems
  • Secure sharing of medical data
  • Personal identity security
  • Recording real estate transactions
  • Gambling

Block 9: Layers

notion image

Layer 0

This is the ground-level infrastructure that blockchains are built on top of. There are many blockchain frameworks that mean developers don’t have to start completely from scratch - they can use a layer 0 and take advantage of many pre-built features.

Layer 1

This is the layer that most people would describe as “the blockchain layer”. Bitcoin, Ethereum and Solana are all examples of Layer 1’s. This is the layer that processes transactions and checks the validity of blocks, as we have seen above.

Layer 2

Layer 2’s are extensions and improvements that allow transactions to be processed faster than on Layer 1 blockchains. Polygon is a great example of a Layer 2 protocol, and we will discuss it in more detail later on.

Layer 3

Layer 3 is the application layer. As a user or consumer, this is the website or app that you actually see in front of you and interact with. Uniswap is an example of a layer 3 that we will mention many times. Uniswap is a decentralised exchange. Using Uniswap's app, you can easily buy and sell some crypto. Let’s say you decide to buy some ETH. This use of the app will then trigger the transaction to occur on the Layer 1 (Ethereum) blockchain.
So that was our blockchain to explain blockchains (how meta). Hopefully, you now understand more about why the words "decentralised" and "trustless" are being thrown around so much these days. The main principles of blockchain networks are that they are public, distributed, time-stamped and persistent (meaning that blockchain records can't be misplaced or damaged in any way). The most important lesson here is that blockchain technology is not some obscure thing related to Bitcoin. It's likely to affect many aspects of your life in future.

Already purchased? Sign in here.