04 How does Blockchain work (step by step)?
05 What is a node?
06 What is a hash?
07 What is a Merkle tree?
08 What is a consensus mechanism?
09 Can everybody see everything on the Blockchain?
10 Can documents be stored on the Blockchain?
In short, Blockchain is a method of securely keeping track of financial and non-financial transactions in a decentralized way. While the technology is complex, the value proposition is simple: Blockchain can establish trust.
Blockchain has three key advantages over traditional bookkeeping:
- Better Security (entries in the ledger are incorruptible)
- Higher Reliability (every participant has a copy of the ledger)
- Lower Cost (no need for a central bookkeeper / middle man)
Blockchain uses cryptographic methods and can be realized using digital technology. The most popular use of Blockchain are digital currencies (like BitCoin) but there are many use cases beyond that – for instance, Blockchain can make companies like Uber and AirBnb obsolete.
Cryptographic currencies use the Blockchain logic to create money systems without the need for banks (both central banks and retail banks). The most popular ones are Bitcoin and Ethereum.
There is a variety of uses for Blockchain Beyond Bitcoin. Blockchain can provide most value if these two questions can be answered with yes:
- Is trust required for the transactions in question?
- Is there a central authority managing transactions and / or users?
Because these two questions can be answered with „yes“ in so many cases, the potential for disruption from Blockchain is so high.
Some example uses of Blockchain beyond Bitcoin:
- Notarization of marriages, house purchases, … (already happening in Estonia)
- Tracking of goods along the supply chain („Track and Trace“ – multiple companies working on proof of concepts)
- Peer-to-peer energy selling between neighbors (e.g., the „Brooklyn Microgrid“)
Blockchain and Ethereum are considered to be matured technologies – participants have entrusted USD 50bn into Bitcoin alone.
On the other hand, most Blockchain business models beyond Bitcoin and Ethereum are still in development – there are only few Blockchains proven at scale (e.g., Ripple).
Currently (2017), Blockchain has the following challenges to be overcome:
- Lacking legal foundation (e.g., enforcement of smart contracts)
- Lacking eco-system of service providers (e.g., Blockchain hosting, maintenance)
- Lack of common standards (e.g., proof of work vs proof of stake)
In 2017, these challenges seem temporary and will be overcome. Additionally, businesses and researchers are putting significant resources in solving these challenges: USD 1.4bn were invested in 2016.
Blockchain is expected to become mainstream in the financial sector in 5 – 10 years and in 10 – 20 years in other sectors.
The aim of a Blockchain is to function as an open, decentralized ledger (=timestamped list of transactions).
Let us use an example to see how this work in detail. Say you wanted to add the entry „Arnold marries Berta“ into an imaginary marriage ledger blockchain. Your Blockchain client (= computer program you use to interact with the Blockchain) would add your digital signature to the message and send it to everybody on the Blockchain. The Blockchain participants would then validate your announcement: Are you currently married to someone else? Is Berta a real person? Is your digital signature correct? If anything is fishy, your announcement would be ignored. If it passes the checks, blockchain participants add it to their private „work-in-progress“ block, alongside other announcements.
These „work-in-progress“ blocks are not yet part of the main blockchain, they just reside with each participant. Each participant tries to add their block to the main blockchain, such that it becomes part of the collective understanding of who married whom. In a perfect world, all blockchain participants would try to add approximately the same block (except maybe someone missed something due to network issues). However, Blockchains need to remain stable and truthful even in case some participants tried to manipulate the Blockchain (e.g., by adding untruthful blocks) – said differently: you do not need to trust the people on the Blockchain, but you need to trust the Blockchain mechanism.
To do this, there are voting mechanisms to ensure that the right blocks are added. These votings are called „consensus mechanisms“. In the most popular one – „proof of work“ – voting power is distributed to participants based on their computing power. It is much harder for a hacker to get 51% of a Blockchain’s computing power under control than 51% of computer addresses.
The mechanism works as follows: Participants’ computers try to solve a complex mathematical puzzle. Whoever solves it first, can add their block to the Blockchain. Before appending the block, the winner checks the last block of the Blockchain: Are all marriages recorded in that block in accordance to my understanding of the truth so far? Does it have any invalid marriages (= winner did not receive digitally signed, valid notification from the newlyweds)? If everything checks out, the winner adds his block on top of the Blockchain. If the winner’s block is truthful, the next winner will further build on it and the Blockchain grows further.
However, if the winner finds that the last block is not o.k., he will put his block not on top of the last block but on top of the previous block (given it is o.k.). The next winner will then have to choose whom he believes and build on top of that block. Eventually, the truthful chain will outgrow the untruthful one as more on more people of the Blockchain community put their blocks on top of the correct strand.
Any computer that connects to the Blockchain is called a node. Nodes that fully enforce all of the rules of the Blockchain are called full nodes.
In some Blockchains, e.g., Bitcoin, there is a possibility to run a „lightweight node“ with less checking. However, running a full node is the only way you can use Bitcoin in a trustless way. You will know for sure that all the rules of Bitcoin are being followed, for example that no bitcoins are spent not belonging to the owner, that no coins were spent twice, that no inflation happens outside of the schedule and that all the rules needed to make the system work (e.g. difficulty) are followed. Full nodes are currently the most private way to use Bitcoin, with
Full nodes are currently the most private way to use Bitcoin, with nobody else learning which Bitcoin addresses belong to you. Full nodes are the most secure way to use Bitcoin, they do not suffer from many attacks that affect lightweight wallets.
A hash algorithm turns an arbitrarily-large amount of data into a fixed-length hash. A hash is thus a sequence of letters and numbers that is linked (almost) uniquely to an input. The same hash will always result from the same data, but modifying the data by even one bit will completely change the hash. Anything that can be expressed stored as data on a computer can be hashed: that includes text, numbers, pictures, videos, audio, …
BitCoin (and most other Blockchains) uses the SHA-256 hash algorithm to generate quasi-random numbers in a way that requires a predictable amount of CPU effort.
The SHA-256 hash of „www.blockchain-faq.com“ is: „74e54d1a754e03e5a024bf95aa15eadcb04a4a2e291cc4a41e39c116873c1c7b“.
Note that the hash of „www.blockchain-FAQ.com“ is radically different: „0d2bafad5446facc9345c10722aed02223eed88c73588dc22cbc920e0b92dd20“
The Merkle tree is an essential mechanism for Blockchains to work securely and efficiently. You can see a Merkle tree depicted below:
In short, a Merkle tree is a binary tree of hashes. In the case of Blockchain, transactions in a block are the content of the tree (in the picture: L1, L2, …). The content is hashed and forms the lowest level of the tree, the so-called leaves (in the picture: Hash 0-0, Hash 0-1, … ).
From left to right, two leaves are hashed together into one hash (in the picture: Hash 0, Hash 1, …). These two are then hashed together into the final hash, called the „root hash“ or „root“. Depending on the length of the content (= count of transactions in a block), the Merkle chain can have varying numbers of levels (no. of levels = square root of transactions + 1).
Why is this important? For a node to check whether the transactions in the block are valid, it just needs to verify one number: the Merkle root. It contains all transactions in a block in hashed form. If the Merke root hash matches the expectations of the node, everything is ok. If not, the node can then check, which transaction is erroneous by going through the levels. In the picture: Is Hash 0 correct? Is Hash 1 correct? If Hash 0 is correct but Hash 1 is not: Is Hash 1-0 correct? Is Hash 1-1 correct? If Hash 1-0 is but Hash 1-1 is not, we know that transaction L4 is not correct. We call nodes that make these in-depth validations „full nodes“. Nodes that check only the Merkle root are „
If the Merke root hash matches the expectations of the node, everything is ok. If not, the node can then check, which transaction is erroneous by going through the levels. In the picture: Is Hash 0 correct? Is Hash 1 correct? If Hash 0 is correct but Hash 1 is not: Is Hash 1-0 correct? Is Hash 1-1 correct? If Hash 1-0 is but Hash 1-1 is not, we know that transaction L4 is not correct. We call nodes that make these in-depth validations „full nodes“. Nodes that check only the Merkle root are „lightweight nodes“.
The goal of a consensus algorithm in a public Blockchain network is to let many different users agree on the current state of the Blockchain even though they don’t trust each other or any central authority. This is a challenging problem, and until the Bitcoin network was launched, it had remained unsolved.
Bitcoin’s solution was to use something called Proof of Work, where participating users worked to solve difficult mathematical problems, and then published the solutions. Because it takes real-world resources like computers and electricity to find these solutions, there’s no way to „cheat“ and pretend that you represent a bigger portion of the mining power on the network than you actually do. As a result, PoW algorithms are able to use the number and difficulty of solutions being found to measure how much of the network agrees on the current state of the Blockchain. The only way to prevent the legitimate users from coming to agreement about the state of the Blockchain is to control enough of the total computing power that you can pretend the group disagrees with itself, or even that your opinion is the real consensus and all the other users are lying about the state of the Blockchain. That requirement for resources is a good thing because it means that interfering with the group’s consensus takes a lot of resources (a.k.a. money).
Unfortunately, PoW consensus algorithms as we presently know them require a constant, ongoing expenditure of resources just to work normally. The work has to be done regardless of whether someone is trying to interfere or not, and someone has to pay for it. Most existing PoW Blockchains, such as Bitcoin, pay for these costs with the pre-agreed creation of coins, also known as inflation. This salary has to be doled out whether or not anyone is attacking, which seems quite inefficient. Motivated by this and other considerations, a new solution to the problem of decentralized consensus was proposed, referred to as Proof of Stake.
In this new algorithm, agreement within the Blockchain would be measured not on the basis of how much computing power agrees with the current state, but instead on the basis of how much digital currency agrees with the current state. The owners of this digital currency hold a financial stake in the success of the Blockchain that tracks it, which is where we get the name for the algorithm.
Short version: Yes, but you can still remain anonymous.
Long version: Everybody on a Blockchain is able to see all transactions as everybody is involved in checking each transaction’s validity. If you want to add an entry to the Blockchain, your computer will tell everybody else on the Blockchain about it. For Bitcoin, you can watch transactions being propagated live on www.blockexplorer.com.
However, this does not mean that a Blockchain cannot be anonymous. In the Bitcoin case, you can create a new „address“ in your wallet for each transaction. Nobody except you knows that this address is linked to your wallet. Because Bitcoin is only transferred between addresses, nobody knows who you exchange money with and you remain anonymous. You can see this in action on www.blockexplorer.com too – you will not be able to allocate money transfers to people or organizations.
Side note: On a permissioned Blockchain, privacy is even higher because the participants (= people to whom new transactions are propagated) are restricted. Only people who have been granted access to the permissioned Blockchain can see the transactions.
Short version: Not in the way you think.
Long version: Documents cannot be stored in a Blockchain like a house cannot be stored in a land registry book. Blockchain is a ledger, that stores timestamped transactions.
Still, Blockchain can be useful for creating an immutable document registry. Let’s go through an example: Alice writes a contract that she wants to send Bob. Alice hashes the contract, producing hash X. She then writes on the Blockchain „Alice sent Bob contract X on 15th Aug 2017 at 2:03pm.“ and signs it digitally. She then sends the contract to Bob via a Blockchain client program. Bob uses the Blockchain client program – once he receives the file, the program hashes it and also receives hash X. The program then writes on the Blockchain „Bob confirms that Alice sent contract X on 15th Aug 2017 at 2:09pm.“
While the file is not stored on the Blockchain but on Alice’s and Bob’s computers, the Blockchain guarantees that both have immutable proof that exactly contract X has been transmitted at a certain point in time.
My name is Maxim Lewinz and I am from Munich, Germany.
I love technology, especially for the way it lets people express themselves. Ever since my dad left a „programming for kids“ book on my night table when I was 11, I used computers to create stuff.
As I grew older, I started using technology to deliver value to others. In college, I created an online coffee store: it never came close to commercial success but I had tons of fun (and good coffee) along the way.
My 2nd startup was an online store for DSLR camera straps: Taking the lessons from „Kaffeetopia“, I was able to build something I was really proud of. After one year, it was bought by another entrepreneur.
I firmly believe that Blockchain is a technology that has the power to revolutionize many industries. I witnessed the ascent of the internet as a teenager: People started using the internet for many things: connecting to each other, buying things remotely, reading the news, and so on. In essence, the internet enabled a more direct connection between content creators, merchants, people – today, we call this disintermediation.
10 years later, the internet startups of the past have become behemoth organizations that hold vast amounts of power over our lives. Did Amazon disintermediate the relationship between customers and merchants? Did Uber enable a true sharing economy? Is Facebook bringing people closer together?
With Blockchain, there is no middle man, it is purely driven by its users. To me, that is real value, delivered by new technology.
However, Blockchain is far from being omnipresent. In fact, I would argue that most people would struggle to define what Blockchain really is and what can be done with it.
With „Blockchain-FAQ.com“, I want to bring people closer to the technology – explaining the core concepts in detail, but leaving out the details that ultimately do not matter (similarly to the TCP/IP protocol of the internet). To do this, I have collected the questions that I asked myself when first exploring Blockchain. If you, dear reader, have any questions that you feel are missing, do not hesitate to reach out.