Where is the blockchain revolution?

A friend of mine asked me: bitcoin was invented 10 years ago, why has not anyone come up with a real product yet? Has anything been disrupted by blockchain?

His disappointment is quite understandable.
Everyone is talking about blockchain as a revolutionary technology, they say it will change how we approach the life, make transactions cheaper and free us from the middle man.
Many times I heard how Air B&B and Amazon will be wiped out by blockchain technology and how blockchain will protect our privacy from Facebook and Google.

Nowadays there are many products based on blockchain but none of them have been revolutionary, none of them changed our approach to life like the first PC, the first iPhone or Facebook.

Where is the claimed disruption?

Enthusiasts are claiming that blockchain will disrupt many industries in the future, but what about now?
No revolution happened yet, lots of good words, speculation and euphoria; even Bitcoin is failing its purpose as a means of payment [1].

The blinding light of making easy money on bitcoin hooked many people; it seduced not just investors and cyber-nerds but also normal people, everyone is hunting for a new business opportunity. If this euphoria does not match with a real solution it will soon turn into disappointment (as I am already reading around).

And the euphoria is a close friend of speculation, not just on bitcoin’s economy but also on the blockchain as term itself; for instance a tea company changed its name from Long Island Iced Tea to Long Blockchain and it got +500% increase on its shares [2]. Isn’t it crazy?

So what’s the state of work right now?

Let’s be realistic: blockchain is a new technology and it is still in development, experimentation and testing. Bitcoin blockchain is still fighting on performance (like transaction speed and fees).
Perhaps in 10 years blockchain will revolutionize our life, or it may fail as well.

Internet was invented in the 1950s but it boomed forty years later in the 1990s [3]. The artificial intelligence was invented in the 1950s but it boomed in 2015 [4].
Bitcoin’s white paper came out in 2008 [5] and now, ten years later, what has been accomplished by blockchain technology?

A lot.

No revolutionary products have been invented yet but many new blockchain platforms were born (like Ripple, Ethereum, Hyperledger or Iota): remember that blockchain is a new world to discover and it is still in development. When the foundation is ready new blockchain products will come out.

Many big tech corporations (like IBM or Microsoft) as well as banks are investing a lot in it.
I’m investing my free time in studying blockchain development and I personally think blockchain will help the humankind technology evolution.
Now it is the right time to invest in this technology if you want to be in the forefront in a close future. Be aware that blockchain might fail as well but no investment comes without risk.

The history of blockchain just started. Don’t let the mass euphoria, disappointment or skepticism blind you, stay calm and keep yourself informed instead.

___________

References

[1] Why bitcoin is failing its purpose as a means of payment:

[2] Tea company that chaged its name: https://techcrunch.com/2017/12/21/long-island-iced-tea-shares-went-gangbusters-after-changing-its-name-to-long-blockchain/

[3] History of the internet: https://en.wikipedia.org/wiki/History_of_the_Internet

[4] History of AI: https://en.wikipedia.org/wiki/History_of_artificial_intelligence

[5] History of Bitcoin: https://en.wikipedia.org/wiki/History_of_bitcoin

___________

Read the original article at www.danielefavi.com

How a blockchain works – the Proof of Work

When we were talking about mining, we mentioned a difficult puzzle that a miner has to solve. What is this puzzle and what is it for?
Before reading this article, I suggest you read these two articles

So what is the puzzle that has to be solved by a miner?

The puzzle that a miner has to solve during the block creation is called proof-of-work. The proof-of-work is a piece of data which requires computational power to be created but it can be verified quickly. Thanks to the proof-of-work the blockchain’s data becomes immutable.

In the previous article we created a simple blockchain and we saw that tampering a block causes the invalidation of the following blocks.
In that example recalculating the hash of invalid blocks is simple, but if we add complexity in the calculation we will make the bad guys’ life difficult.

What is the proof-of-work for? Why do miners spend so much effort on mining?

The proof-of-work is a mechanism for reaching global consensus on the valid blockchain: since all nodes have a copy of the blockchain, each node must agree on the conditions that prove how much effort a node has spent on verifying transactions.
In other words: if the content of the blockchain is easy to change then everyone can tamper with it; instead, if each block is calculated with complex mathematical functions then it takes a lot of effort to tamper with the blockchain.

Let’s check the proof-of-work more in depth.

Let’s create a blockchain where the blocks are linked to each other through an identification code; a block contains the following data:

    • identification code of the previous block (PREV)
    • name of the sender (SENDER)
    • name of the receiver (RECEIVER)
    • bitcoin amount (AMOUNT)

To make the calculation difficult, every identification code must start with 0000 (four zeros). To do this we have to add a new field called NONCE.

For a better understanding let’s take an example.

The first block of our blockchain includes the following data (please note that the identification code of the previous block is 0 because this is the first block):

PREV:0
SENDER:john
RECEIVER:jenny
AMOUNT:100
NONCE:1

Now let’s copy this block content, then paste it in the hash calculator and press the button Calculate SHA-256 Hash (be careful with spaces and new lines). The hash is as follows:
07b01b0f4672f2bc58ef11132df4bc74a4e0dc9f2e07ee5d9a0428d3836bc6cb

As you can see the code starts with b273 and not with 0000; so you must increase the NONCE and repeat the calculation again (note that increasing the NONCE from 1 to 2 leads to the change of the content and consequently the hash changes too).
Now our block is:

PREV:0
SENDER:john
RECEIVER:jenny
AMOUNT:100
NONCE:2

and its hash is:
263172553403d3182866ed4d2e7b588a6932e58d0acaa1fa92958a1f70dfabc5

The code still does not start with 0000! You must repeat the calculation all over again until the code starts with 0000. OK, I will give you the solution: you have to repeat this process 22683 times!

PREV:0
SENDER:john
RECEIVER:jenny
AMOUNT:100
NONCE:22683

Hash code: 00000d7d33ebf71c24c15119c925acf9d9d45f8f9972034e2c8b1aabe29163a7

As it was said in the previous article, the hash is a one way function, so the only way to find the block’s identification code that starts with 0000 is making random attempts (the method is called brute force).

Let’s create a blockchain that we made in the previous article but this time we will apply the proof-of-work to it; this is what we get:

If you tamper the first block, you will break all the blockchain and for every block you will have to calculate the hashes that start with 0000 again! So, when a certain block has many blocks after it, this block becomes secure.

In the bitcoins world a block becomes secure when it has at least 6 following blocks; keep in mind that the difficulty of the hash calculation is much higher than our example.
If you want to tamper the bitcoin’s blockchain, remember that every fake block must comply with the calculation difficulty criteria and moreover you have to create fake blocks faster than the other miners in the network… to achieve this you need 51% of the computational power of the whole network!

Nowadays the blockchain technology is pushing to find other ways to reach the network consensus because the proof-of-work is not energy-efficient at all. Some of these new ways are proof of stake, proof of burn or casper.

___________

More Info

Bitcoin hash rate: https://blockchain.info/it/charts/hash-rate?timespan=all

More info about proof-of-work: https://en.bitcoin.it/wiki/Proof_of_work

HASH calculator: https://www.danielefavi.com/sha256-hash-calculator/

PHP code that I used to create the blockchain example: https://github.com/danielefavi/blockchain-hash-block-calculator

___________

Read the original at www.danielefavi.com

How a blockchain works… Let’s make one!

Have you ever wondered why the blocks on the blockchain are stored one after another?
In this article we are going to talk about the basic blockchain concepts; these concepts will be fundamental to grasp how the proof-of-work works, why the mining requires lots of computational power and how the blocks become immutable.

The blockchain technology uses a mathematical function called Hash which turns data into a 64 character long code. The hash code identifies the block in the blockchain and protects its content.

What is the hash?

The hash is a mathematical function that turns every type of data (like text or file) into a string of 64 characters. The output code never changes for the same input. The hash is a one way function: it is easy to generate a code but starting from a hash code it is impossible to get the original data.

Let’s take an example: this is the link to my website where you can find the hash calculator https://www.danielefavi.com/sha256-hash-calculator/.
Let’s type “test” in the text field and then press the button Calculate SHA256 hash. The generated code is:
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08

Now let’s type “test.” (add only a full stop) in the text field Data and press again the button Calculate SHA256 hash. The generated hash is:
4ee3df88f682d376531d8803f2ccbee56d075cd248fc300f55dfe8596a7354b7

Adding a full stop makes a difference, the code of “test” is totally different from the code of “test.” Even the addition of a space or a blank line or change a letter to the capital letter can change completely the hash of the output code.

It is easy to calculate the hash, but it is very difficult to get back the starting data from the hash. For example try to find the word that matches with the following hash:
3866daf66ad5f7e6dbf8c983b06287d7ad254336a172d8f34eb1cb4f25f12b70
You can search for a starting word doing lots of random attempts until you will find the corresponding word (this method is called brute-force).

Let’s create a simple blockchain to understand what the hash is for.

Our blockchain contains simple information: a list of people with their names and ages; the name and the age are separated by a dash:

  • Block 1: Natalia-28
  • Block 2: John-45
  • Block 3: Paul-21
  • Block 4: Claire-67

Every block must have an identification code: this code will be calculated with the hash.
In order to build a chain of blocks you must link each block to its previous one: so a block must contains the identification code of the previous block.

For a better understanding let’s build our blockchain.

Let’s start with the first block: since the block 1 has no previous blocks we can choose zero: 0-natalia-28.
Now go to the hash calculator and calculate the hash of 0-natalia-28; the hash is:
51831cdd6acfaee6c7402cea12c58f514bc014d495e185610ee6cc664452d23d

Let’s take only the first 5 digits of this code (to make our life easy) and put them at the beginning of the second block: 51831-john-45.
Go back to the hash calculator and calculate the hash of 51831-john-45; the generated hash is:
4e942233bba491ab530669fa78c03b3e72c4e3940834e3e960d9ca32ed959429

Again, take only the first 5 digits and put them at the beginning of the third block, obtaining 4e942-paul-21.
Repeat the same process for the blocks #3 and #4; the chain that you have built is:

Let’s tamper with the blockchain!

For our friend Natalia, from the first block, let’s change the age from 28 to 25. So, changing the content of the block will result in the change of the hash of the block too.
The new content of the first block is 0-natalia-25 and the first 5 digits of the new hash are 07698.

Since the identification code of the first block changed (before it was 51831 and now it is 07698) we must update the hash code inside the second block that refers to the first block. With this update the content of the second block changes (now it is 07698-john-45) so we have to calculate again the hash of the second block: the first 5 digits of the hash code of 07698-john-45 are 43339.

The hash code of the block #2 is changed, as well as the content of the block #3. The content of the block #3 is 77e83-paul-21.
As you have already guessed, since the content of the block #3 is changed, we must calculate again its hash, which will cause the change of the content and the hash of the block #4.

The change of the content of the block not only invalidates the block itself but causes the invalidation of all the following blocks.

This article showed us how a blockchain is structured. In the next article we will see how to prevent a blockchain from being tampered.

___________

Read the original article at www.danielefavi.com