In this post I explain **how a Blockchain works with a very simple example** and step by step. If you already know a bit of Blockchain technology, go straight to the second part of this article, about consensus.

If you’d like to learn a bit of history, I recommend you start from here:

**Blockchain in baby steps**

*Tim asks Linda for a small loan in class, Linda agrees but needs some confidence on Tim returning her the money*.

Linda has several options. The first is to ask the teacher to observe the transaction, so Linda lends 10$ to Tim and Tim says he will return the money in one week. After that week Tim returns the 10$ and the teacher will observe the transaction so the debt is settled.

**That was easy, trust stablished system, but…**

But Linda doesn’t want to trust a single person who can change his mind. So instead of asking their teacher to observe the transaction, she asks to the rest of her classmates.

There are 20 students in class apart from Tim and Linda. Linda asks her schoolmates to take note of the transaction: *“Tim owes Linda 10$”.* When Tim returns her the 10$, all of them write again: *“Tim returns Linda 10$”*. So the effect is the same: debt settled. But there is a difference, **Linda is no longer trusting a single person. Instead, if there’s any problem Linda will ask her classmates and what the majority says will be chosen as the correct.** In this case Linda thinks that it is much harder to trick or convince 11 boys and girls than the teacher.

Fortunately in the real world the figures are several orders of magnitude higher.

**Expanding one problem to one reusable solution**

This worked for a single transaction, but what happens when the rest of the students start using the same method? Even students from other classes?

When the number of transactions grows a lot that means that in case of a dispute, there are a lot of records and different notebooks to search in and compare. **Here comes the cryptographic help: each student has in his own notepad **(we will call that a **“ledger”**)** holding a number of records that are processed in a block**. In order to query the real status it is not necessary to compare all ledgers as we will use some techniques to be sure that all of them are the same.

**Hash & Proof of Work: Inmutable they say**

Performing a complex operation to each block we will find a special signature of the block (a hash). This complex operation is the search of a number that added to the block will alter the hash in order to comply with one special requirement: it will start with a given number of zeroes. This operation takes quite a lot of compute power, and the block hash will be the seed for the next block:

**This way all the blocks are chained**. And having the same hash for the block in all (or in the majority of them) the students’ notebooks tell us that the block has not changed, so what it says is true.

**Using this technique, if anyone wants to fool the system and change some information from the past if is not only necessary to “convince” more of the half of the participants to change it but also to re-calculate the hash for that changed block and all the following blocks**. This is why this technology is called “Blockchain” and the calculus made is called *“*** Proof of Work, **or

**PoW**”. That is used in bitcoin, the first and most famous cryptocurrency.

Now, keep learning about other consensus algorithms beyond Proof of Work in the next post 👉 **Blockchain: about trust and uncertainty (the real tale about consensus)**