Skip main navigation

How do blockchains work?

What's the process to create a block within a blockchain, and how does it become secured? Learn more in this article.

One of the many impressive things about blockchains is that the way they work is both simple and elegant.

Let’s explore the process together now.

Creating a block

A ‘block’ is a set of digital transactions, instructions or information that has been undertaken on a particular blockchain in a given time period, say 10 minutes as in the Bitcoin blockchain.

In its most basic form, a block contains a ledger of transactions, such as funds transfers or purchases. However, blocks can also contain sets of agreed instructions between parties (known as ‘smart contracts’) or a range of decentralised applications (known as ‘dApps’, which we will cover later this week).

decorative image

In order to ensure that the right people are making transactions, a ‘Private/Public’ key system is used. However, this is not covered in this introductory-level course.

Validating the block

Before a ‘block’ can be added to the previous ‘chain’ of blocks, the transactions need to be validated. In the case of the Bitcoin blockchain, this means each host assesses the full history of the chain to make sure that the transactions can take place.

For example, if you want to transfer 2 BTC (Bitcoin) to your brother’s digital wallet, each host will need to verify that you actually have 2 BTC and that your brother’s wallet address is legitimate. Once this is done, it is ready to add to the chain.

Closing the block

Once a set of transactions or information contained in the block is validated, the block is closed and it is given a unique identifier called a “hash” using the SHA256 algorithm, which consists of a string of 64 numbers and letters, with a possible 1077 combinations (with the number of atoms in the known universe estimated to be between 1078 and 1082).

Should anything be changed in the block, the identifier for that new set of data would be different, even if you just changed a comma to a full stop – and this is part of the magic.

Adding the block to the chain

Now that the block has been populated with information about transactions or agreements, and it has been validated and closed, it is ready to add to the chain.

This is done by copying the hash, the string of 64 numbers and letters that was created for the previous block, into the new block before creating the new block’s hash, effectively embedding the unique identifier from the previous block into the new block, over and over, and over again all along the chain right up to the most recent block.

Securing the chain

Now that a ‘chain of blocks’ has been created, which is (not surprisingly) referred to as a ‘blockchain’, we need to keep it secure. Rather than storing it on a central server, or a few interconnected ones, a blockchain is secured using a community, without the need for a central controlling entity.

How this is done is quite clever; once the most recent block has been added to the chain, the new chain is copied across numerous computers and the most recent hash of all the copies is monitored to make sure that everyone’s copy has the same final hash. In the case that one of the hosts is hacked and something is changed in a block, then that block will have a new hash which means every block that follows it will also have a new hash right up to the most recent block, signalling that a change has taken place.

If we were being specific, we wouldn’t say that a chain is “un-hackable” but rather that it is “tamper evident”, meaning that if a change is made then it is immediately obvious, and that host is removed from the community. Pretty cool, hey!

decorative image

We are not quite there yet, as there is another challenge to overcome.

Although hosting a blockchain is a pretty cool thing, especially for computer enthusiasts, it is not free as it takes up hard drive space and computer processing power. Therefore, the hosts across the community need to be rewarded in some way – this brings us to what is referred to as a ‘consensus mechanism’. In short, it’s a way to ensure that there are enough members of the community hosting the chain so that it can’t be changed while also providing an incentive to hosts.

This can be done in two main ways, namely using either a ‘proof-of-work’ approach or a ‘proof-of-stake’ approach, which we will explore in the next article.

This article is from the free online

Introduction to Blockchain for Business

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now