This is not an explanation of the blockchain, or is it?

Jan van Boesschoten
Coinmonks

--

Leonardo da Vinci was a great artist and scientist. Before he drew an arm, he literally analysed it to the bone. He knew exactly how the muscles were working and how they were attached to the bone. This makes his drawings and paintings lifelike stills of bygone times. His empirical method of working also enabled him to design machines far ahead of his time. Today we call this way of working, scientific: observe, analyse, draw conclusions, verify and start all over again. For me, the blockchain is all about this, not only to understand the technology but also its impact.

The blockchain is comprehensive, challenging, and it is a big puzzle. Once you have solved one piece, a new one pop-ups. To understand and judge the many articles, initiatives and business cases, I dived into the essences of the blockchain. I tried to write them down for everybody to understand whether you are a consultant, marketeer or writer. As much it was an exercise for me, I hope I succeeded, and you gain some knowledge after you read this article.

There is no better start than with a quote of Satoshi Nakamoto about what the blockchain is

an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party

Blockchain
A blockchain is nothing more than lists of transactions chained together. Copies of this chain of blocks are distributed over multiple computers (also called nodes). These blocks are built, distributed, and chained together, making it impossible to alter something in a block without it being noticed. To understand how it is done, we need to dive into a technique called hashing.

blocks chained together by hashes

Hashing
Hashing is giving digital content an almost unique fingerprint (almost unique because there is a very very very minimum chance that two pieces of content generate the same hash). The SHA-256 Cryptographic Hash Algorithm is used to hash content in the blockchain. This algorithm generates a 256 bits (32 bytes) fingerprint of 64 characters from any piece of digital content.

Some examples:
The word “blockchain” has the following hash: ef7797e13d3a75526946a3bcf00daec9fc9c9c4d51ddc7cc5df888f74dd434d1.The word “blockchai” (without the n) has the following hash:
cacacb4e20ce56824aea249d1d3facb26ff56955c2602562166a2ba88e6fb50.

A change in the content results in a completely different hash. You can hash any digital content type, so also images, pdf’s and so on. It doesn’t matter how long or big the file is; it generates a hash of 64 characters. For instance, the hash of Satoshi Nakamoto’s White paper (9 pages) is:
ddfaed83c71daaab14a4045df42319afba8e7200441aad3ed0d92aa9cc0d8e7a.

But you can also hash a hash. Try some hashing yourself to fully understand the concept. Here is a link: https://passwordsgenerator.net/sha256-hash-generator/ or https://hash.online-convert.com/sha256-generator.

Note!
It’s important to notice that hashing content is not encrypting content. The original content cannot be recreated from the hash it generates. You can only generate the exact same hash when you have the original content.

Chained
So, let’s go back to how the blocks are chained together. Each block starts with the hash of the previous block. This hash is partly the result of the block's content (details later). So if you would change something in a block, the hash of the block changes. The direct result will be that the hashes that connect the blocks don’t correspond any more. Therefore the chain will be broken. As copies of the blockchain are distributed over numerous nodes, it is immediately noticed when one copy is corrupted.

Let’s have a closer look at a block that is just a list of transactions. To do that we first will dive into transactions.

Transactions
To do transactions on the blockchain, you need to download and install the software: the wallet. You use the wallet to manage your transactions. You don’t have to identify yourself to download and install the software. So you are an anonymous user.

When you install a wallet, you get two keys:
- a private key
- a public key

These keys are mathematically linked together. This means that what is encrypted with your private key, can be decrypted by your public.

Note!
The private key is the one you don’t want to lose. If you do, nobody can help you. The blockchain has no central authority to redeem your key as in “forgotten password”.

As a user, you can initiate transaction like you send emails. Really simple. You don’t see the complexity under the hood. But what happens under the hood is really important.

Your public key is also your public address to receive transactions.
You use your private key to generate a signature that identifies you when you do a transaction.

There are three important items in a transactions:
- a message with the details of the transactions (amount and the to-address)
- your public key
- your signature

Your signature is generated as follows:
- the message with transaction details is hashed
- the hashed messages together with the private key generates a signature

creating a signature

Because the hash of the message is used in the signature, every signature is unique, so copying somebody’s signature is not an option because the hash depends on the message's content and even if you have the message you don’t have the private key to create a signature.

A transaction consists of:
- the original message (not hashed)
- the signature
This is sent to the blockchain.

Validation
When the transaction arrives, it is validated.
- the signature is decrypted with the public key and reveals the hash of the message and the sender.
- the message (not the hashed one) is hashed and the hash is compared with the hash that came out of the signature's decryption. If they are the same, you know that the message hasn’t been altered

validation the transaction

If the transaction is valid, your funds are checked, and when you have enough funds, the transaction is added to a pool of transactions. Transactions out of the pool will be added to the blockchain's next block.

Building a block
So your transaction is now waiting to be added to a block. The messages tell which bitcoins have to be transferred from one address to another. Miners (computers running blockchain software to add blocks to the blockchain) take two messages and make a hash out of them. Then they take another two messages and hash them too. Out of these two hashes, a new hash is generated, and so on. Merkle Tree is made out of all the transactions (see image). So, in the end, there is only one hash: the root hash.

Now you see that if only one transaction is changed at the bottom of the tree, the root hash changes. But we are not done hashing, let’s hash some more.

merkle tree and the root hash

Mining: solving the puzzle
The root hash is combined with the hash of the previous block and a nonce number. This is a random number. These three items generate a new hash that will become the block's identifier. However, this hash needs to meet some criteria.

And now we are diving into mining, giving birth to bitcoins and solving the puzzle. The new hash criteria are set by the number of zeros that the hash has to start with. The more zeros, the more difficult it is to find the right hash.

mining

When talking about solving the puzzle and that the puzzle's difficulty is automatically adjusted, it is all about changing the number of zeros that the hash needs to have in the beginning.

Finding the right hash is called mining. The person who finds the correct hash can add the new block to the blockchain. So what miners do, is
- add transactions to a block
- generate a new root hash
- combine this with the hash of the previous block
- add a nonce make a new hash
- hope that that hash has the right amount of zeros
- if not, start all over again

You can imagine that this takes a lot of calculating power. The miner that finds the right hash can add his block with transactions to the blockchain and receives 12,5 bitcoins (at this moment) for it.

But mining is not only generating those hashes, in the process, all transactions are constantly validated between the miners to come to a consensus on whether a transaction is valid or not.

The puzzle's difficulty is automatically adjusted to guarantee a block will be added every 10 minutes. So if more people start to set up mining facilities, and therefore the mining capacity grows, the puzzle's difficulty will be adjusted by adding more zeros to the hash.

This kind of mining is called Proof of work; all the miners work on solving the puzzle; the one who solves it first can add the block. Another form of mining is called Proof of Stake. Then one miner gets the assignment to build and add a block.

Conclusion
I know that I described the bone of the arm at best. The muscles and skin still need to follow. But hopefully, you have a better understanding of mining, solving and adjusting the puzzle and the security features (hashing and distribution) of the blockchain. There are many blockchain variations, and the technology keeps on developing. But remember, whether you use ethereum, hyper ledger or other blockchain technology, the blockchain is all about transactions and cutting out a third party.

Books
The Age of Cryptocurrency: How Bitcoin and Digital Money are Challenging the Global Economic Order by Michael J. Casey and Paul Vigna

Links
https://www.wired.com/story/when-the-blockchain-skeptic-walked-into-the-lions-den
https://chrispacia.wordpress.com/2013/09/02/bitcoin-mining-explained-like-youre-five-part-1-incentives/
https://www.fastcompany.com/40576008/congress-just-wound-back-wall-streets-clock-and-throttled-innovation
https://www.flightclub.com/nike-air-mag-jetstream-white-pl-blue-090135
https://www.coindesk.com/information/what-is-blockchain-technology/
https://www.coindesk.com/information/how-bitcoin-mining-works/
https://dev.to/damcosset/trying-to-understand-blockchain-by-making-one-ce4
https://blockchain.info/charts
https://blockgeeks.com/guides/what-is-hashing/
https://www.movable-type.co.uk/scripts/sha256.html
https://medium.com/capital-one-developers/bitcoin-blockchain-and-building-blocks-9f304380c77d
https://www.khanacademy.org/economics-finance-domain/core-finance/money-and-banking/bitcoin/v/bitcoin-transaction-records
https://www.bitcoin.com/info/how-bitcoin-transactions-work
https://blockgeeks.com/guides/proof-of-work-vs-proof-of-stake/
https://blockgeeks.com/omg-ethereum-hard-forked/
https://blockgeeks.com/guides/cryptocurrency-wallet-guide/
http://www.the-blockchain.com/2018/05/08/independent-music-platform-choon-beta-launches-with-notes-token-payments/
https://www.khanacademy.org/economics-finance-domain/core-finance/money-and-banking/bitcoin/v/bitcoin-what-is-it
https://www.youtube.com/watch?v=bBC-nXj3Ng4
https://www.youtube.com/watch?v=l9jOJk30eQs
https://www.youtube.com/watch?annotation_id=annotation_558919243&feature=iv&src_vid=l9jOJk30eQs&v=Lx9zgZCMqXE

--

--

Jan van Boesschoten
Coinmonks

As an educated historian, entrepreneur and self taught technologist I like to connect the dots of technical, social and economic developments.