Blockchain 101

Blockchain 101 – Part 1: What is a Blockchain?

Hello, and welcome to this brand new short-serie on Blockchain. I am going to explore how a blockchain works starting from some background about how the concept of blockchain was born and from which (curious) part of hell came from (basically I will give you some background history so that you can impress your friends). Next, I will dive deep into the concepts of blockchain, how it works, why it works that way and what are the implications.

 

So, before starting, imagine you are graduating in medicine and surgery. Today you start a new course about how a blockchain works (it makes no sense, I know, but let's pretend). However, the only way to understand this concept is through…blockchain autopsy…and yes, this is what we are going to do.  (I’m joking, as always, you can follow along even if you got a weak stomach, no blood, I promise).

 

 

This course is divided in multiple parts. I will update this post each time a new part is released so that you can reference here.

Blockchain 101 - Summary

The Origins

The first time someone conceptualized something similar to a blockchain was in 1991 when Stuart Haber and W. Scott Stornetta published an academic paper “How to Time-Stamp a Digital Document”. The paper highlights a technique which is adopted nowadays by the blockchain technology and is called Timestamping.

Timestamping a digital document, in simple terms, means that you take a digital document (like a picture of your cat dressed like a pirate) and you apply something called an “hash function” (more of this will come later in details in future parts). Once a document has been “hashed” then it is saved with a timestamp associated.

“A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second.” - Wikipedia.

Timestamping associates a precise moment in time to the hash of the document (hash of the document —> the result of applying a hashing function to a document). The precision with which a document can be timestamped is in the order of milli/nano-seconds. Finally, the hashed documents are linked together in a sort of chain, where each hash includes a hash of previous records’ certificates. (I know, it might sound confusing and intimidating but you will get there once we will introduce what a blockchain really is).

 

A live timestamp showing the current UTC time can be viewed at unixtimestamp.com

 

TAKEAWAY

For the time being just understand that if you take a digital document, and you apply a hash function, you obtain a hash. A hash is a string of characters and numbers (nobody understand) which represents the fingerprint of that document. No other document in the entire world will never have the same resulting string/fingerprint (this is not entirely true, there might be collisions which we must avoid but this is not relevant at the moment).

Blockchain 101

Image representing the process of generating a hash from a document via a hash function (which also looks very complex and technical and gives me a little more of credibility).

The mysterious Satoshi Nakamoto

Despite the great work from Haber and Stornetta, the birth of blockchain is generally associated to the release of Satoshi Nakamoto’s Bitcoin paper in 2008.

 

If someone of you is wondering who this “Satoshi Nakamoto” is…nobody knows, might be a group of people, a single person or even your partner’s secret lover (in the latter case, I wish you never find out who Satoshi Nakamoto is, LOL). The paper on Bitcoin, definitely is a piece of work which laid the foundations for advances in peer-to-peer networks. In his mind, Nakamoto wanted to create a so-called “purely peer-to-peer version of electronic cash” which would allow online payments to be sent directly from one party to another without going through a financial institution.

 

And this…this is what decentralization is all about: creating a network of nodes which are distributed and can interact together autonomously without a central "governmental" entity. Each node partecipate in the network and acts as a voting entity deciding on the future of the network together with the other nodes. This simple concept is the foundation of the entire Decentralized Finance world. I vividly suggest you to read the paper on Bitcoin.

 

Now, what is a Blockchain?

Ok, before entering the concept of nodes and decentralization we first need to understand the building blocks of a decentralized network.

 

Say hello to the blockchain, the core part of the entire decentralized finance world.

 

Blockchain 101

 

How do we define a blockchain?

If you head to Wikipedia you will find the following answer:

 

“A blockchain is a continuously growing list of records, called blocks, which are linked and secured using cryptography.” - Wikipedia

 

Blockchain 101

 

In other words, you can think of a blockchain as way of storing data (like a database, a warehouse or a register). The main difference is that in a blockchain, each record (each piece of data) is stored in blocks which are linked together and secured. Let’s examine those two affirmations:

  • "linked together" means that each new block, which is added to the chain, is always linked to the previous one and to the next one;
  • "secured", means that records are stored in a way that no matter what, you won’t never be able to modify a single record in a block unless you modify all the future (or following) blocks.

 

To give you a visual idea of what I am talking about, take a look at the following animation.

Blockchain 101

As time goes by, new blocks (which hold the records) are added to the chain. This creates a sequence of immutable linked blocks.

 

What is a block and how is data stored?

If you’ve already asked this question to yourself then your curiosity will set the path for your future job in DeFi.

 

A block is a container of data, it is actually what holds the records stored in the blockchain. In computer science a block can be easily represented with a so-called Data Structure, an "object" represented by properties which are unique. Think about a Person, digitally speaking a person can be represented with a serie of attributes like: first name, last name, gender, height, weight, age and so on.

Blockchain 101

A block is exactly the same, it has properties like a person (different properties of course, not the age and weight, you lucky block!). What properties?

Let’s examine them with the following picture.

 

Blockchain 101
  • The previous hash: the result of the previous block after a hash function has been applied to it. This hash, uniquely identify that previous block. If you are confused about what really a hash is, consider it as the fingerprint of the block. No other blocks will ever have the same fingerprint (hash) as the previous one.
  • The hash: the resulting hash of the current block (spot the concept of chain here? Do not worry I’ll be back to it in a second).
  • The data: this is the record itself, of course more than one record can be stored in a block, but to simplify, you can also imagine a single record.

 

For the moment we will skip all the remaining properties of a block (we will introduce them in the future) as they are not relevant for the topic at hand.

Blockchain 1010

The Genesis Block

We are talking about a chain of blocks right? Then what’s the matter with the first block ever created? Good question.

 

To initialize the chain we need a Genesis Block, a block which of course will have some records stored as well as its hash property (fingerprint). Its previous hash property instead, will be exactly 000000000.

 

Why’s that? Of course since there are no previous blocks, there won’t be any previous hash!

image

Blocks creation and insertion into the Blockchain!

This is where all the previous concepts converge. Let’s see how a blockchain is built starting from the genesis block.

Blockchain 101

The first step is the creation of the genesis block. Next, new blocks are created and inserted into the chain (notice how all the new blocks have a previous hash property which refers to the hash of the previous block).

 

This happens because even if the genesis block does not have a previous hash, it actually has its own hash (or fingerprint). This hash, in the next block (block number 1) will become the previous hash. And this process goes on to infinity: block 2 will have (as a previous hash) the hash of block 1, block 3 will have the hash of block 2 as the previous hash and so on.

 

“Blocks are cryptographically linked together”.

 

This concept is what the property of immutability in a blockchain is all about. So, keep that in mind!

 

If you change the data in a block (say you tamper it), the resulting hash will change as well. We would obtain a different fingerprint, and this would not match the previous hash property stored in the next block invalidating the chain from the tampered block onwards.

 

Blockchain 101

 

One aspect that might sound mysterious in all of this is...how is it that changing a single record inside a block, results in a complete different hash/fingerprint?

 

The answer you seek will be revealed in Part 2.

 

Thank you for reading and do not forget to follow me on Twitter for future updates!