What is Blockchain and How Does It Work?

At its simplest, the blockchain is just an incorruptible collection of transactions organised in units of blocks, which are linked using cryptography. Learn more about how blockchain works with our beginner-friendly explanation below!

Home » What is Blockchain and How Does It Work?

We already discussed how we got from physical ledgers all the way to blockchain in a previous article. This article in turn examines what blockchain is and how it works in a bit more detail. But we’ve made sure this piece is absolutely clean of anything tech-heavy as well, so that anyone can follow through with ease.

In this article, we will attempt to answer the following questions:

  1. What is blockchain?
  2. How does blockchain work?
  3. What does a block in a blockchain look like?
  4. How is a new block added to the blockchain?
  5. Can you change transactions on the blockchain?
  6. Conclusion

What is blockchain?

Let’s start with defining blockchain in simple terms. We will use two existing definitions of blockchain and combine them into what we think is a great way to start understanding the internals of blockchain in plain English:

The first definition we will use is by Don and Alex Tapscott, authors of the Blockchain Revolution book, who write:

“The blockchain is an incorruptible digital ledger of economic transactions that can be programmed to record, not just financial transactions, but virtually everything of value”.

Let’s combine this with the way Wikipedia defines blockchain:

A blockchain is a continuously growing list of records called blocks, which are linked and secured using cryptography”.

Now let’s highlight certain words from both these definitions:

Incorruptible

Digital Ledger

Continuously growing list of transactions

Linked and secured using cryptography

The first word is digital ledger. It helps to think of blockchain as a ledger used in accounting or a big book that records all kinds of transactions.

Next is continuously growing list of records – just like a ledger of transactions which is an ever-growing list.

Then there is the word incorruptible. So until now we have a continuously growing ledger of transactions that cannot be corrupted.

Finally, these transactions are linked together in some way using cryptography.

So the blockchain is an incorruptible, digital ledger that is a continuously growing list of records, linked and secured using cryptography.

Before diving into the blockchain internals, let’s just take a moment to remember why we even need this technology.

Most of us have used a traditional bank account. A bank in this case can be seen as a large, reliable institution that you trust to handle your money and transactions. A trust so deeply ingrained in most of us, that we can easily count all the years we’ve been with our banks, and take it completely for granted.

A man in suite and a bank
Traditional money systems make individuals dependent on banks

But the reality is that we, as individuals, are putting a lot of trust into an institution to manage our money. We trust them that they keep our data safe and secure. But in fact, there have been many examples of banks accidentally revealing sensitive financial data to third parties. And even more cases of banks going down in a single point of failure when they have IT system failures (during upgrade of IT software systems for example, or deployments that have taken down transaction processing systems).

Even banks with excellent reputations have such failures. Even if these failures are temporary, they are still utterly frustrating for individuals who can’t access their money or transaction history.

Occasional or rare IT failures that eventually get resolved might not be seen such a big issue. But remember the recent case of Greece where, when the economy ran into severe problems, the Greek government put controls on the banks and caps on how much money people could withdraw. This effectively scraped people from the full control over their money.

So although we are used to this centralised control from organisations and institutions, there is actually another option. That is to be decentralised. Being decentralised essentially means that no single entity is in charge. So there is no concentration of power, and neither is there a risk of a single point of failure. When something is decentralised, it is present in multiple places, and all the copies in the multiple places are equally valid. Blockchain is an example of such decentralisation, and we will examine its internals next.

How does blockchain work?

The heart of the blockchain is actually just a collection of transactions. These transactions form what is called a block. The transactions that form the block can record just about anything of value: movement of money between people or companies, or movement of any piece of information, like the transferring of property or the tracking of movement of inventory between different companies. 

Many such blocks are then linked together to form a blockchain. Here is what a blockchain would look like from a high level:

Internal structure of blockchain
Blockchain’s structure

What’s important is that the data stored in a blockchain is designed to be kept in a way that makes it almost impossible to change it without being detected by other users. This is what makes the technology so powerful.

So while in traditional banking, transactions are verified by an authority such as a bank, in blockchain technology these intermediaries are made redundant. Let’s understand how.

Blocks in a blockchain are chained securely together using cryptography. When the transactions are put onto the block, a cryptographic hash is calculated for the whole block. This hash represents all of the transactions in that block . This hash can be thought of as the block address. Then, each next block keeps a copy of the hash of the previous block. Thus a chain of blocks (block chain) is formed.

Internal structure of blockchain with hash keys
Blockchain is linked and secured by cryptographic hashes

What does a block in the blockchain look like?

Let’s now delve on the structure of an individual block.

A block in a blockchain has two sections, the block header and the transactions section. The transactions section contains all the transactions and their details. 

The structure of an individual block in a blockchain
A block in a blockchain

The block header usually contains a block number, the creation date of the block,  the block hash, as well as the block hash of the previous block in the chain. The block hashes are usually calculated using the SHA-256 algorithm. Other algorithms are also often used in different blockchain implementations.

Note that the block hash of any block is calculated by running the hashing algorithm on the combination of the following:

  • the transactions found in the block,
  • the block number,
  • the block creation date, and
  • the hash of the previous block. 

Take note that the hash of a block takes into account the hash of the previous block as well. So if the hash of the previous block was changed, the hash of the current block will change as well.

The first block of a chain that is not linked to a previous block is called the genesis block. Its previous block hash will be null, or empty. 

A SHA-256 hash function is applied to a block in a blockchain
The hash function is applied on the block transactions, the previous block hash and some other data points in the block header

Given this structure of a block, how do we make sure the data hasn’t been tampered with?

Well, we can recalculate the hash of that block by applying the hashing algorithm on the transactions and block header data points. If the hash is the same as the block hash stored in that block, it means the block is intact and hasn’t been tampered with.

If, on the other hand, the newly calculated hash doesn’t match what was already stored in the block as the hash, it means the block data was changed in some way. So there is no longer data integrity.

Moreover, when we try to calculate the next block’s hash, it will also be different (even if nothing was changed in that block.) Why? Well because a block’s hash is calculated on the transactions of that block and the hash of the previous block. So if the hash of the previous block was changed, the hash of the current block will change as well. Even if the rest of the data in that current block wasn’t changed at all.

Three blocks of a blockchain, each containing the hash of the preceding block as well as their own hashes.
Each block contains its own hash as well as the hash of the previous block

How is a new block added to the chain?

For a new block to be entered in the chain, the creator of the block has to solve a complex mathematical puzzle while calculating the block hash. This hashing puzzle is called mining the block with Proof-of-Work, and is designed to be computationally expensive. It is an intrinsic part of the block hash calculation process, and has important implications on the reliability of the blockchain, as we are about to see next.

Can you change transactions on the blockchain?

Let’s see what would happen if someone maliciously tried to change some transaction in one block of the blockchain. Say that the blockchain contained 1000 blocks, and that calculating a block hash with the proof-of-work concept mentioned above took 15 minutes on an average computer.

Now imagine someone maliciously wants to overwrite the data in the first block. Since they’ve changed some data in the block, they now have to recalculate that block’s hash, which takes 15 minutes. But since the next block points to the first block’s initial hash, the second block needs to be updated to contain the new hash of the first block. Hence the second block’s hash needs to be recalculated as well, which takes another 15 minutes. And then of course you need to do the same for all the next blocks in the chain. This means that to change data in block 1 of our blockchain of 1000 blocks, you need to spend 255 hours or more than 10 days recalculating the hashes of the whole chain.

Imagine how much longer this would take if the chain is much longer and the mining puzzle more complex. So the longer the chain, the more secure the blockchain is. Additionally, since blockchain is a decentralized technology, a copy of it is available to all the computers (or nodes) of the network. Let’s say 100 nodes have copies of the whole chain and someone tries to change one of the blocks. They might be able to do that in one node, but this version would not be trusted, because there will still be 99 other nodes containing the original version of the blockchain. 

Conclusion

In this article, we defined blockchain as an incorruptible digital ledger of a continuously growing list of records, linked and secured using cryptography. 

Structurally, blockchain is just a chain of blocks linked together via their block hashes. These blocks consist of two parts, the block header and the transactions section. The transactions section is just a collection of transactions (which can be about anything of value, not just financial transactions). The block header, among other things, contains the block hash of the current block, as well as the block hash of the previous block in the chain. This is what we mean when we say that blocks are cryptographically linked by their hashes. The hash of the block is calculated by using some cryptographic hashing algorithm (like SHA-256, for example) on the data found in the block. This hash is then stored in the header of that block, but it is also stored in the header of the next block in the chain.

If any piece of data belonging to a block is tampered with, calculating the hash of that block produces a new, completely different value. This new value does not match the original hash stored in that block. Additionally, since a block hash is also stored in the next block in the chain, the next block will also fail verification. This is then propagated to all the subsequent blocks in the blockchain. This makes blockchain tamper-evident, as no data can be tampered with without being revealed by these mismatching block hashes.

So what would prevent somebody from maliciously tampering with some transaction on a block? Maybe they get away with recalculating the block hash for that block, as well as for all the remaining blocks in the blockchain? Although this is theoretically possible, the block recalculation is such a resource-intensive and expensive process, that would nullify any benefits that the hacker might gain.

Additionally, the blockchain is of a distributed nature, so it is replicated across many computers worldwide. This means that even if some hacker would manage to alter the copy of the blockchain in one computer, all the other copies found in the rest of the blockchain network would still contain the original, untampered version. That version by consensus would be considered as the valid one. 

What does the blockchain look like internally?

The blockchain is simply a collection of transactions organised in units of blocks. Many blocks are chained together to form a blockchain, which is then replicated across many computers participating in the blockchain network.


What’s in a block of a blockchain?

A block in the blockchain consists of a block header and a transactions section. The block header contains its block hash as well as the block hash of the preceding block in the chain. The transactions section is simply a collection of transactions.


How are blocks linked into a blockchain?

Blocks in a blockchain are linked via their block hashes, i.e., each block, apart from its own block hash, also contains the block hash of the preceding block.


How is a new block added to the blockchain?

A new block is added to the blockchain after its block hash is calculated by solving a complex mathematical problem, known as the hashing puzzle. This process is also known as proof of work.

bitcoinBitcoin
$ 16,942.282.63%
ethereumEthereum
$ 1,274.134.88%
tetherTether
$ 1.000.15%
bnbBNB
$ 301.590.74%
usd-coinUSD Coin
$ 1.000.12%
binance-usdBinance USD
$ 1.000.26%
xrpXRP
$ 0.4048812.96%
dogecoinDogecoin
$ 0.1067923.03%
cardanoCardano
$ 0.3164011.19%
matic-networkPolygon
$ 0.8733633.64%