Blockchain has been pushed into the limelight by a new and controversial form of digital currency called Bitcoin. The success stories of early Bitcoin investors and the launch of Ethereum, a platform allowing the creation of decentralized applications, brought blockchain and cryptocurrencies to the frontier where decision-makers and executives started to pay attention to this emerging piece of technology. Many curious persons began to wonder how it could help them in their personal or professional enterprises, leading them to believe that this innovation could be an appropriate answer to their business issues. The Economist, on October 31, 2015, published the first well-known article about blockchain (https://www.economist.com/printedition/covers/2015-10-29/ap-e-eu-la-me-na-uk).
As a decision-maker, being educated enough about new technologies and innovations is paramount for your company to explore and experiment with emerging enablers that will bring competitive advantages and help you to reach a steady growth. Being able to thrive in the digital age is more and more a necessity and a complex task, especially because technological breakthroughs and mass innovation trigger a sharp shift in people's consumption habits, as well as geopolitical challenges and economic changes. Being able to consider, evaluate, and incorporate new technologies to tackle your company's business goals has become critical.
With that in mind, you should be aware that blockchain has the potential to be a paradigm shift that can redesign how organizations operate and how value is shared between economic actors. This disruptive technology is said to change how the world works, how entire industries function, and how value is being exchanged and secured. But, as promising as it is, you must act with caution. We are at the dawn of what blockchain can achieve and it is not a hundred percent mature—it's still being considered an emerging technology.
Throughout this chapter, we will consider an illustration of a blockchain application that will help you to picture and grasp the concepts with ease. By the end of this chapter, you should be able to understand the usability of a blockchain in certain environments and conditions, especially when it comes to exchanging value directly between individuals. You should be able to explain basically how a blockchain works, what are its inner characteristics, and how Bitcoin operates without any central authority.
This chapter includes the following sections:
- The significance of blockchain in the business world
- Understanding blockchains
- Breaking down blockchains
The latest Gartner's Hype Cycle, published on August 20, 2018, shows how far blockchain is from massive adoption: 5 to 10 years (https://www.gartner.com/en/newsroom/press-releases/2018-08-20-gartner-identifies-five-emerging-technology-trends-that-will-blur-the-lines-between-human-and-machine).
As stated by Gartner, blockchain has shown many great stories and successful proof of concepts propelled by a wide media coverage and publicity, but still faces many failures and scalability issues. Some products have seen the light, with a real impact on economy and society (Bitcoin and Ethereum are the most well-known) but the mainstream adoption and broad market applicability (the so-called plateau of productivity) will be reached only if products are sustained with large investments and the technology is understood more and more.
According to PwC's 2018 Global Blockchain Survey, 84% of C-level executives report that their organization already has involvement with blockchain technology, but more than 65% of them have not pulled through the pilot stage yet.
There is a significant misunderstanding around the concept behind blockchain and its applicability within the business world. Cryptocurrencies and blockchain's recent hype makes executives assume that it stands as an answer to every business challenge. In fact, blockchain has to be considered as a layer for securitizing transactions and ensuring transparency of information and authentication of stakeholders in a decentralized environment. Blockchain is often seen as a difficult notion to grasp, especially for non-tech people. This book will help you to identify, as a decision-maker, the opportunities offered by blockchain for you to understand its applicability and ultimately give you the keys for initiating a blockchain project.
Before diving instantly into the technical part, which will be covered in Chapter 2, A Technical Dive into Blockchain, you should first have an overview of what a blockchain is. If you have already read or heard about the topic, you might have figured out that it is appropriate for any use case relying on trust being ensured by a third party and where value is exchanged between different stakeholders. With the help of a simple example taken from an imaginary situation, the following sections will hopefully unravel the things you might have been confused about and the things you are eager to understand.
Imagine a village of 20 people living on an island in the middle of the ocean, without connection to any other tribes or countries. We will call this village, Village Alpha. They live a peaceful life in a resourceful environment where no one lacks anything.
Question: How do the people of Village Alpha exchange and trade goods and services between each other?
Avoiding the downsides of bartering, they invent a gold-minted coin, a form of money similar to a dollar bill in today's economy. Because this coin is portable and easy to identify and has a value in the eyes of all of the villagers, it quickly becomes the principal means of payment within the community. To ensure proper trade between each other, they record every exchange in a ledger and appoint one of them as the referring bookkeeper to maintain its accuracy and authenticity. The appointed bookkeeper is rewarded for his/her integrity and honesty by collecting a fee on every transaction.
And that's it! People can buy and sell goods with their gold-minted coins. The truth is ensured by the bookkeeper who keeps the ledger up to date, incentivized to behave fairly by levying fees on transactions. Anyone can challenge him/her by checking the transactions to ascertain proper recording.
The villagers found a solution to their problem, unknowingly inventing the banking system that prevails nowadays.
Now, let's assume that the bookkeeper is dishonest. Imagine he/she modifies the ledger during the night and erases some transactions or adds new ones? What if he/she destroys the ledger?
You can see that this system has its shortcomings. The villagers are currently using what we call a centralized payment system where everyone relies on the bookkeeper to ensure the truth.
In our modern society, the bank plays the role of the bookkeeper. When you send money to a friend, you trust the bank to carry out the correct fund transfers
This has major downsides:
- A single point of failure: Imagine a storm wipes out the village and the ledger with it.
- A trusted third party that can be dishonest: Imagine the bookkeeper modifies the transactions.
- A double-spending problem, which, however, is not applicable in our example because we assume they exchange physical goods. If the villagers were exchanging digital value, double-spending would have been an issue in the way that they would need an infrastructure to prevent replication of the digital assets. In other words, they would need a means to prevent an asset to be spent twice. More on that later.
So, how does blockchain offer a powerful alternative to this traditional centralized payment system?
Let's take the village on the neighboring island to see how they proceeded from the initial problem of exchanging goods. This village, which we will call Village Beta, is also composed of 20 people.
Instead of electing one of them as the bookkeeper who will certify the truth and the history of transactions between them, they find another solution.
They create a book in which each page is designed as a spreadsheet with ten lines and three columns. The lines will be used to input transactions and the columns to input three pieces of information: the sender's address, the recipient's address, and the amount, as shown in the following diagram:
Then, they replicate the book 19 times and hand over one copy to each villager so that everyone possesses one book. Finally, they craft 10,000 coins that they call Villagecoin and distribute 10 to each one of them, leaving the remaining in a vault.
When someone wants to make a transaction, he or she has to go to the central place of the village and shout to everybody else what transaction he or she is willing to make. When hearing the transaction, the other villagers write it down on the first page of their book: Alice gives 2 Villagecoin to Bob, Chuck gives 5 Villagecoin to Dan, and so on. In this way, every transaction is recorded in everyone's book, as shown in the following diagram:
With this system, no one was entrusted to assert the accuracy of a central book but instead, everyone is responsible for their own book.
This organization allows two things:
- Transparency: The villagers can check whether a villager has enough money. Since all of the transactions are recorded, it's easy to check that Alice cannot send 15 Villagecoin to Dan, since she was given 10 Villagecoin on the first day and then sent 2 Villagecoin to Bob. She has therefore, only 8 Villagecoin remaining.
- A first level of security: Since everyone should have the same book and history of transactions, if Alice came to falsify a transaction in her book, it would turn invalid because everyone else (the majority) has the correct transactions recorded. Alice would just end up with an incorrect book and would need to retrieve a valid copy from another villager.
In this example, the book is what we call a database (or ledger), where all transactions and value transfers are logged. The village is the community that empowers the ledger; it is a network infrastructure where the villagers are the following:
- The nodes and the miners: They are the entities that validate the transactions and store the ledger (more on that later).
- They are the users of the service provided by the network. In this example, the service is the ability to use a decentralized means of payment (Villagecoin) to sell and purchase physical goods. It can be compared to Bitcoin.
So far, we have seen some quite interesting things. We already demonstrated the decentralization feature of the blockchain and how a database can be shared and track-recorded across a network without being altered.
Now comes the most important and hardest feature to understand: security.
As stated before, each page of the book is designed with 10 lines. So, what happens when we get to transaction number #10? We surely need to go to the next page. However, before doing so, the villagers must validate the transactions and seal the page.
To keep the transactions secured, the villagers decide that each page must be removed from the book and put away on a special wall that will display each page once it is completed. This way, the villagers will be sure that the transactions (hence, the pages) displayed on the wall are true, valid, and correct.
Let's stick to the example to understand how it works.
The wall that displays the valid pages will not let any villager put his/her page on it. After a page is completed with 10 transactions recorded, only one villager gets to put his/her page on it. To do so, all of the villagers will have to compete to find the result of a mathematical problem.
Here is the delicate part that makes a blockchain immutable and unalterable.
There is a section on the wall that has two small screens that will display some information every time a page is completed:
- On Screen A, a number is displayed that we will call the reference number.
- On Screen B, the date and time are displayed.
Under these two screens, there are two other screens where the villagers will input data:
- On Screen C, the villagers will input the 10 transactions of the completed page.
- On Screen D, the villagers will input a random number we will call number X.
Finally, a final screen displays a rule that must be respected when solving the mathematical problem, as shown in the following diagram:
To keep this chapter's consistency and help you to understand everything, we will further define the rule, the reference number, and number X. Everything will make sense by the end of this chapter. For now, just move on with how pages are completed and displayed on the wall.
When page #1 is completed, all of the villagers gather before the wall to take notice of the information provided in the two first screens. In our example, we have the following:
- Screen A: Reference number: 0
- Screen B: Date and time: 2018/06/25, 03:25 PM
The rule given on the wall is as follows:
"The output number to be found when solving the mathematical problem must start with two leading zeros."
Do you remember that, for a page to be accepted on the wall, the villagers will have to solve a mathematical problem?
Well, this problem is set like this:
Screen A's reference number + Screen B's date and time + Screen C's transactions of the page + Screen D's random number input by the villager (number X) = an output number following the rule given by the wall (a number that starts will two leading zeros)
In this equation, we actually know four out of the five variables:
- Data from Screen A (the reference number) is given by the wall: 0.
- Data from Screen B (the date and time) is given by the wall: 2018/06/25, 03:25 PM.
- Data from Screen C (the transactions) are to be filled by the villagers. They are written on the pages of their books.
- Data from Screen D (the rule) is given by the wall: The output number to be found when solving the mathematical problem must start with two leading zeros
The equation can be pictured like this:
Now, the hard part for the villagers is to find the correct number to enter on Screen D for the equation to return a number that respects the rule of the wall: a number starting with two leading zeros.
To help you to visualize the mathematical problem, it can roughly be represented like this:
For this equation, the answer would be easy because we know that we have to add the numbers together and number X to find an output lower than 10. Here, number X would be equal to 1 or 2:
However, in Village Beta, no one knows the wall's algorithm. No one knows the logic of it and how the problem should be computed. They will have to try a lot of different number X solutions to find the correct output.
In this section, we shall try to break down the mathematical problem, number X, the reference number, the rule, and how they work together to allow recording transactions in a consensual and secured manner.
Let's summarize what we have so far:
- The page is what we call a Block.
- Date time provided on screen B is what we call the timestamp of the block.
- Number X is known as a nonce. It is the number that the nodes of the blockchain network (in our example, the villagers) try to find to reach the output number that respects the rule given by the wall.
- The process of finding number X is called mining.
- The rule given by the wall is called a hash function.
- We will see what the reference number is, in later sections.
Before moving on with the mathematical problem, let's first focus on the rule given by the wall, the so-called hash function.
A hash function is a mathematical function that transforms any chain of characters or numbers into a fixed-length chain of characters. It turns data into a digital fingerprint called a hash. For example, if I enter euclide (7 characters) into the hash function called SHA-256, it will return the 64 characters hash: E0F4C627CD4D365EE9760BAA6A1CD35CA26CF7252F6EB25C0DC7B4C3E2718A20.
Now, if I input into the same SHA-256 hash function the entire Wikipedia's Bitcoin page description, it will return: D5752C643EC97DC0FF32AE74FF2F2079043A8AB0191C51AEFDE09EDE0C757EE6.
It returns 64 characters—all of the time—whatever the length of the input is.
The hash function is deterministic: it is always the same output for the same input.
The following diagram depicts the process explained in this section:
The principle behind a hash function is, when you know the output, it is very hard to find the input because the reverse action is not possible. That is, knowing the digital fingerprint of data does not reveal that specific data. You cannot guess that I entered euclide if I tell you that the output is E0F4C627CD4D365EE9760BAA6A1CD35CA26CF7252F6EB25C0DC7B4C3E2718A20. However, when knowing the input, it is very easy to find the correct output. Indeed, you can easily verify that euclide returns the hash E0F4C627CD4D365EE9760BAA6A1CD35CA26CF7252F6EB25C0DC7B4C3E2718A20, just by entering it into the SHA-256 hash function.
If we return to Village Beta, you might have understood where this is going:
- The reference number, 0
- + the timestamp of the page, 2018/06/25, 03:25 PM
- + the transactions (the data written in one page of the book)
- + the nonce (number X)
- = return the hash of page #1 (an output number following the rule: a number starting with two leading zeros)
The preceding equation can be pictured like this:
Consequently, to find the output number (a number starting with two leading zeros, or the hash of the page), every villager will have to try several inputs for number X for the equation to return a number respecting the rule.
It is as if I asked you: using the SHA-256 hash function, can you find an output number starting with two leading zeros? How many inputs will you try before finding a correct output?
Eventually, one villager, named Dan, finds an appropriate number X. He tells everybody else that the number 12345, combined with the timestamp, the reference number, and the transactions return the output number, 0031993. As regards the rule, this number is a valid output because it starts with two leading zeros.
Because it is very easy to find the output when you know the input, every other villager can verify that number X, 12345, is a correct data that return a valid hash, that is, for the mathematical problem to be solved.
Once everyone has verified that 12345 is the correct number X (the nonce) that returns the output number 0031993 (the hash value) that respects the rule, Dan is allowed to display his first page on the wall, hence becoming the reference page:
Now, why should every villager try to find number X since somebody is going to find it anyway and tell everyone else? Why should a villager spend time and effort to have his/her page validated and displayed on the wall?
We introduce here the incentive mechanism, an economic payoff for the community to play fair. Because the pages should keep being sealed to keep the transactions accurate, the community should continuously work on solving the mathematical problem. In this manner, a reward is given to the villager who finds number X, that is, the first villager to find the correct hash of the page. In our example, Dan is rewarded with, say, 5 Villagecoin.
This incentive mechanism ensures that everyone keeps interested in working for the common good. More on that in Chapter 2, A Technical Dive into Blockchain.
Now that page #1 is displayed on the wall and secured, transactions continue to take place: Chuck sends 5 Villagecoin to Alice, Dan sends 2 Villagecoin to Bob, and so on.
When page #2 is completed with 10 transactions, the villagers repeat the entire process all over again.
So, what is the reference number? Remember that, on page #1, the reference number was 0?
For page #2, it will be 0031993. Exactly! The reference number of page #2 is the output number found for the previous page. In technical terms, we call it the previous hash or the hash value of the previous block. This allows the pages to be linked with one another, or to be chained to one another.
So, when page #2 is filled, the process repeats: every villager gathers at the wall, which displays new information on screens A and B:
- Screen A's reference number (hash of the previous page, page #1): 0031993
- Screen B's date and time (timestamp): 2018/07/03, 10:08 AM
The following diagram displays the new information on the wall:
Then, the villagers input the transactions of page #2 in Screen C. Finally, everyone tries to find the correct number X (the nonce) on Screen D, which will return an output number starting with two leading zeros.
When an output number following the rule is found, number X is announced to everyone else who checks that number X, combined with 0031993, the timestamp, and the transactions, returns a number that starts with two leading zeros. If everyone agrees, we put the page on the wall and reward the villager who found the correct input with 5 Villagecoin.
And then the process repeats with page #3, page #4, and so on:
Let's evaluate how secured this system is. Let's assume that Chuck wants to modify a transaction on page #2. He wants to erase the 5 Villagecoin he sent to Alice during the completion of page #2, and change it to 1 Villagecoin.
What will happen?
He will have to solve again the mathematical problem for page #2 because he modified the transaction of page #2 (hence, the data of Screen C). Because of this slight change, the wall returns an entirely different output number, say 37882, which does not respect the rule anymore. Therefore, Chuck has to calculate the new number X on Screen D that would return a number starting with two leading zeros for page #2.
How is that a complication for Chuck?
Imagine that Chuck actually finds a new correct number X that returns an output number that starts with two leading zeros. Because hash functions are change-sensitive (a slight modification in the input returns a totally different output), even if Chuck finds a new correct input, the output will totally be different from the original. Say the new output number for page #2 is 00829 instead of the initial 0088. What will happen on page #3? The reference number (previous hash) will be different and so will be the output number of page #3. Furthermore, it is very likely that the new reference number of page #3 (00829 instead of 0088) combined with the rest of the data on the other screens will return a number that does not start with two leading zeros, hence making the page (and the transactions with it) invalid. In this fashion, Chuck will also have to compute again number X of page #3, then of page #4 and #5 and every page validated afterward.
This is how security is achieved in a blockchain, by sealing and chaining the blocks containing the transactions.
The more pages (blocks) are put on the wall (validated), the more secure and unalterable are the transactions. Because it would take a tremendous amount of time and computing power to re-calculate every number X (nonce) of every page (blocks) in order to find the correct output numbers that start with two leading zeros (hashes), the wall (the blockchain) is the best technology for storing and securing the transactions of the villagers (nodes and users).
Throughout this chapter, we got a foothold in blockchain by introducing the main economic aspects and challenges, discovering, with the simplest example, what this technology is about and how it works. The Villagecoin case is a realistic representation of Bitcoin, the first blockchain application ever and the most famous one. It is an imaginary situation that illustrates how decentralization and distributed ledgers enhance cooperation between individuals that do not trust each other, allowing them to exchange value without any confiding intermediary. Hopefully, we also demonstrated, in the most comprehensible way, what are hashes and nonces, which enable the blocks to be chained together, bringing security in a decentralized infrastructure, at least in those based on this mechanism. But more on that later.
In the next chapter, we will discover how cryptography, consensus mechanisms, and peer-to-peer networks can achieve mass coordination in a trustless environment. In other words, we are going to explore, in a technical sense, the main features and components of a blockchain.