paint-brush
Introduction to the Blockchain: the basicsby@nathanmukena
2,305 reads
2,305 reads

Introduction to the Blockchain: the basics

by Nathan MukenaSeptember 27th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Have you heard about the blockchain before? You know, that awesome new technology everyone is making a big deal about? Although you may still ignore what makes it so special technically, you simply know that it is another cutting-edge technology which could end up changing your life. Maybe you’re one of those who decided they wouldn’t spend time trying to figure out how it actually works. After all, very few people would decompose their newly bought I-Phone to find out how it was made. Same for the blockchain; it won’t really matter until it is actually helpful or fun to use. Or would it?

Coin Mentioned

Mention Thumbnail
featured image - Introduction to the Blockchain: the basics
Nathan Mukena HackerNoon profile picture

Have you heard about the blockchain before? You know, that awesome new technology everyone is making a big deal about? Although you may still ignore what makes it so special technically, you simply know that it is another cutting-edge technology which could end up changing your life. Maybe you’re one of those who decided they wouldn’t spend time trying to figure out how it actually works. After all, very few people would decompose their newly bought I-Phone to find out how it was made. Same for the blockchain; it won’t really matter until it is actually helpful or fun to use. Or would it?

The blockchain (especially the public blockchain) was invented to be economically and socially disruptive. The very reason for its existence is to transform the way we transact and exchange value by suppressing the need for a costly and intrusive mediator (or middleman). If it succeeds in its purpose and is widely adopted, it may have profound consequences on our society. Experts realize this (see my previous article) and praise the benefits of a new decentralized economy. But skeptics also see the issues which could result from its use (see this article).

Knowing a little bit about the blockchain may be helpful for the future. The interest around the blockchain technology keeps on rising and we may one day have to decide whether we should use it in our daily activities. Understanding the blockchain can be challenging but resources are available to get you introduced to the topic.

I encourage all to do their own research on this topic and get an idea of what this technology looks like. In this article, I’ll focus on the technical aspects of the blockchain.

Basic elements

Every blockchain in the world will be dealing with following elements:

  • There are parties — individuals, you, me, people, organizations.
  • There are assets — stuff that people can exchange.
  • There are transactions — the exchanges of stuff between individuals.
  • There are blocks — a set of new transactions put together.
  • A chain — a sequence of blocks. Also known as the blockchain. There is no central authority responsible over the chain. Rather, every party involved will keep an accurate copy of the chain.
  • There is a frequent consensus — parties must regularly come together and agree on what new blocks are accepted in the chain (one of the things that make the blockchain technology special).
  • Cryptographic hash functions — the foundation of the blockchain technology in my opinion. More details below.

These elements are essential characteristics of a blockchain.

Blocks and Hashes

Since the blockchain is a chain of blocks, the first step to mastering the blockchain is to understand what a block is. Generally speaking, a block is a set of recorded transactions meant to be added to an existing chain. Here’s an example of a block.

Example of a block.

The above block contains a number of transactions of different types. Transactions may refer to an exchange of value, a confirmation, a change of role, etc. As a matter of fact, our block can contain any information you would like.

However, using this block enables you to make it available and readable to everyone as soon as that block is added to the chain. Anyone who has access to the chain will be able to see your transactions. But even so, no one will be able to change the data without getting noticed. How is a simple block of data not vulnerable to attacks and corruption when that block is accessible to thousands of individuals in an unsupervised way? Thanks to cryptography (more specifically cryptographic hash functions)!

Cryptographic hash functions are awesome! Feel free to read up on how a cryptographic hash function works but a summary is that it takes your whole block of data and compresses it into a short message called a hash signature. Every block will have its own unique hash (collisions — two different blocks having the same hash signature — are possible but extremely rare). Changing even one tiny bit of data on a block will automatically cause its hash signature to be significantly different. Imagine, for example, that one individual named Kevin wanted to change a transaction on Block 68. The true hash signature of block 68 would be enough to tell there has been a change.

Cryptographic hash functions are what makes the blockchain reliable. An effective hash function is one that (1) dramatically changes its result when the block is even slightly modified, (2) has low chances of collisions, and (3) is time efficient. A good blockchain is one with a great hash function first and foremost. Bitcoin, for instance uses SHA256 while Ethereum uses Keccak-256.

An unbreakable chain

Here’s how, with only blocks and hashing algorithms, you can create a chain of information that can preserve its integrity while being shared with everyone within a network. Let’s take the block from the previous paragraph and give it a header.

Block and block header

Typically, the block header contains information about the block but we will focus on 2 key pieces of information:

  • The hash of the previous block: every block must contain the hash of its preceding block.
  • The Merkle Tree of the current block: if you are interested in knowing exactly what a Merkle Tree is, I recommend this article. For the sake of brevity, I will simply state that it is a combined hash signature of every transaction in the current block. The Merkle Tree allows you to check whether a transaction in a block actually belongs to that block.

Here’s what the blockchain looks like:

A chain of blocks — Blockchain

The block header helps you know two things:

  • If one block of the chain has been changed: the following block contains its hash and the next block contains the hash of that block and so on. If that block is changed, its hash will not match with all the following blocks.
  • If one transaction in a new block has been changed: the Merkle Tree allows you to verify transactions.

Note that the very first block of the chain , called Block 0 or Genesis Block, is different from the other blocks since there is no preceding block. This is what it typically would look like.

A Peer to Peer Network

Now that we understand what the blockchain is — a ledger of transactions that is effective at keeping its integrity — we need to explain the last valuable quality that sets it apart as an innovative technology: it is a distributed ledger. A typical blockchain is shared across a large peer-to-peer network of hundreds to thousands of computers — usually called nodes or miners — responsible for:

  • Maintaining their own updated copy of the ledger
  • Collaborating together to achieve consensus when a new block is about to be added to the chain. Here’s a picture of the network:

Conclusion

I hope you can see now that the blockchain allows any transaction to be recorded in a transparent and secure way without the help of a bank or a money transfer agency. If you would like to trade an asset, you simply need to submit a transaction to the blockchain network. Once the computers of the network agree to write the transaction on a block and add that block to the chain, this transaction remains on the blockchain permanently. How do thousands of computers manage to achieve regularly consensus? I shall address that question in my next article.

Helpful Resources:

https://blockgeeks.com/guides/what-is-hashing/


Merkle Tree Introduction_The aim of this post is to provide an overview of the basic Merkle Tree data structure and a jumping off point for more…_hackernoon.com