Skip to 0 minutes and 12 secondsIn the previous lesson, we talked about Bitcoin and digital currencies. Bitcoin’s blockchain made peer-to-peer trading of electronic cash possible. But what is a “blockchain” and why is it necessary? Blockchain is a new paradigm of organization. It’s an incorruptible ledger that allows users to establish connections without the need of a middleman or third party, and recording all transactions in a decentralized database. Let’s see the challenges we face when we try to make electronic cash transactions possible. If we manage to understand how these mechanisms work, then we’ll understand how a blockchain works.

Skip to 0 minutes and 56 secondsLet's say we have three people: Alice, Bob and Chuck. Each with a computer and internet connection, and they want to start trading with the currency they created. Let’s say they name the currency ABC-coin, and they decide to assign an initial quantity of 10 units to each of them. Chuck takes the lead and creates a spreadsheet that acts as a ledger for the distribution of ABC-coins, and grants read and write access to Alice and Bob. Whenever there is a new transaction the sender writes a new record in a row of the spreadsheet, indicating the previous owner of the ABC-coin, the new receiver and the amount is transferred.

Skip to 1 minute and 40 secondsHowever, after some time this solution proves to be inefficient, since they have to trust each other and believe that nobody is cheating the records or trying to manipulate the spreadsheet. Additionally, the database is stored on Chuck’s computer, so he would always be able to manipulate it at will. And even worse! They fear that all the data will be lost if Chuck’s computer ever crashes. To avoid this, they decide that each of them will keep an exact copy of the ledger file. That is a good decision. But what happens if Chuck insists on faking data? Imagine Chuck registers a new transaction in his ledger, indicating he got 10 ABC-coins from Alice.

Skip to 2 minutes and 25 secondsAlice never executed this transaction, so next time they compare their ledgers there is a conflict. There is a way to solve this situation. They need to make sure transactions can only be registered by the person sending the coin. After some thinking, they find the perfect solution. They decide to add digital signatures to every transaction. To enable this system, each of them gets assigned a pair of keys, one public (visible for the other users) and one private (only visible for the owner). They add a new column in their spreadsheet and they label it as "Signature". When Alice wants to send 1 ABC-coin to Bob, she signs the transaction using her private key.

Skip to 3 minutes and 9 secondsThe private key will be saved in the spreadsheet, and now Bob and Chuck will be able to verify the signature by using Alice’s public key. All of them also agree that the sender of ABC-coins must always send the record of the signed transaction to the others, so they can add the transaction to their ledger as well. Chuck cannot easily add new fake transactions anymore. He could, however, delete old transactions or change the amount of coins he sent to somebody and add a new digital signature to those. The modification could be traced and found, but it would require a lot of time and resources. And no one wants to be in charge of that! Chuck is very persistent.

Skip to 3 minutes and 52 secondsTherefore, they need a way to avoid manipulation of the history of the ledger and turn it immutable. To achieve this, all transactions need to be chained in a way that modifying an old transaction requires all the posterior ones to be changed as well. That would increase the difficulty of cheating enormously. They conclude that the solution is for the digital signature to be based on information about the previous owner of each coin. This can be done by adding an hash of the previous transaction. This hash works as and identifier and it will be explained later in the course. This way, each new transaction is linked to the previous one, making possible to trace the chain of ownership.

Skip to 4 minutes and 39 secondsImagine Alice wants to send 2 ABC-coins to Bob. To register the transaction, she will use the hash of the transaction with which she received those 2 coins in first place, and Bob's public key. On top of that, she will sign this two values with her private key. So, as displayed in Bitcoin’s whitepaper. "Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin" Cheating is now a much tougher job. And the three of them have walked the first steps toward the creation of a blockchain. However, it is known that each law has a loophole.

Skip to 5 minutes and 25 secondsStay with us to learn what other challenges will they face, and how will they end up creating a fully functional blockchain!

The creation of a blockchain

Watch this video for an overview on blockchain technology and its main characteristics: storage, non-alterability and immutability.

A lesson from Alexander Kaiser, Blockchain Developer at BlockInfinity

Share this video:

This video is from the free online course:

Blockchain in the Energy Sector

EIT InnoEnergy