Chapter 4

Understanding how a blockchain works

Discover the concepts of this revolutionary technology, understand how a blockchain works and the terminology behind it.

Clock icon10 minutes|Pascal Hügli|Published 2021-02-25|Updated 2024-10-31

TL;DR

What is a blockchain?

A blockchain is a database technology designed to keep a live, public and immutable record of transactions in a decentralized way, i.e. without needing a trusted third party to guarantee its integrity.

How does a blockchain work?

A blockchain works as a ledger that keeps track of transactions in chronological blocks that are verified and recorded by a decentralized network of computer nodes.

What is a blockchain node?

A node is a computer acting as a participant in a blockchain network, running its software to process and validate the blockchain's transactions.

What is a blockchain hash?

A hash is a mathematical function that converts data into an encrypted output. With blockchains, hashes are used to mark each block of transaction with a unique fingerprint, which ensures that the chain of blocks has not been altered.

Many people have been and are still sceptical towards blockchain technology, as it has been loudly touted as a panacea to solve all the world's problems. Naturally, they have concluded that this new technology must necessarily be waived off as pure hype. In this article, we will explain you why it is definitely not the case!

Although blockchain is of course not a magical solution to anything, the truth is that it genuinely represents a revolutionary breakthrough in how humans can interact in a socially more scalable way. It simply needs to be properly defined and understood.

So, what is a blockchain?

In its most fundamental form, the blockchain is a database. It is a database that is distributed over a network of so-called nodes. Nodes are network participants representing computers spread across the globe. All of these computers run a blockchain's software, a programmed protocol that acts as a sort of language that these computers use to communicate with each other. Because of this feature, the blockchain is usually also referred to as a distributed ledger technology (DLT).

Blockchain network diagram

Here's what a blockchain network looks like, computers talking to each other.

Of course, computers don't speak to each other the way we humans speak to one another. They rather "gossip" and propagate information amongst all the nodes, as these nodes interact in a peer-to-peer fashion with one another.

The information that is being shared takes the form of ledger updates. But what exactly needs to be updated in a blockchain? It is the network's transaction history that each and every single node keeps track of, as programmed by the blockchain's protocol.

An immutable history of transactions

Within the blockchain, cryptographic encryption is used to record transactions and their creation dates. Transactions are bundled in blocks and these blocks are then hashed together.

A hash is a mathematical function that converts one value into another. Hashing data is a common practice in computer science and is used for several different purposes. With blockchains, so-called one-way hash functions are used. These are functions that generate a unique fingerprint of an input, but there is no way to get back to the original input. If the input remains the same, the hash is always the same. If on the other hand it changes at all, even by one character the output hash is completely different.

Hashes are an important component of a blockchain's transactions. Every block of transactions is marked with a hash (#) that refers back to its predecessor block. This way, a complete transaction history is created. Now you also know where the "block-chain" got its name from.

Blockchain transactions and blocks diagram

Representation of blocks and transactions, with block 8 being filled with new transactions.

This transaction history (or chain of blocks, for this matter) is identical on all the computers within the network. If a new entry to the transaction history is made, an updated version is propagated to each and every node in the network immediately. Or more technically, as soon as a change occurs on one ledger and does not contradict the mathematics behind the program code, each and every computer's state of the ledger is automatically updated in accordance. In this way, the entire network is always in sync.

Blocks of the Bitcoin blockchain

The latest blocks of the Bitcoin blockchain, as you can see them on mempool.space.

Because every block (and with it every single transaction) is hashed, i.e. connected via its unique digital fingerprint to the previous block, changes of the transaction history would be immediately detected with the ledger's latest update by all the computers.

If the content of a single transaction is subsequently adjusted—the identification number, or hash, of this block changes, which creates a discrepancy with the hash number of the next block. The nodes within the system would instantly notice that the hashes within the transaction wouldn't add up anymore. Any attacker trying to double-spend a transaction would be caught in the very act. That is how a blockchain is protected from manipulation.

The work of miners

But how are new blocks added to the existing chain in the first place, and who ensures that they contain valid transactions? This is where the so-called miners or validators come into play.

Competitively striving to attach a new block to the blockchain, each miner tries to create a new block corresponding to the blockchain's algorithm as quickly as possible, using computing power. Following a specific time interval that is different from blockchain to blockchain, miners get the blockchain's native token distributed to them as compensation for their work.

Not all the miners get all the rewards all the time. There is a fierce competition among them and only whatever miner finds a solution to a problem proposed by the blockchain's algorithm first is rewarded.

As an illustration, we could picture the miners of a blockchain rolling a dice a gazillion time. The miner who first rolls a six one hundred times in a row will win the race. He will be presenting the solution to the other miners, who will then check the result and thus ensure that only valid blocks are integrated into the blockchain. Once a block is verified, all the miners dedicate themselves to the next block and try their luck again.

Crypto mining GIF

Blockchain miners, artist's impression.

This process is called proof-of-work. Because a blockchain, by design, has no central accountant to update its ledger, proof-of-work guarantees that its ledger is being maintained by a variety of different actors. Ultimately, miners can be seen as a blockchain's decentralized bookkeepers. As such, proof-of-work is a mechanism that helps the system to continuously find consensus, allowing everyone to check which transactions have been carried out in which order. This means that there is always consensus - agreement, if you prefer - about who owns what and when in the network.

At this point, one might ask: How can one even "own" something on a blockchain network? As a matter of fact, no one really ever owns a blockchain's native token. In the true sense of the word, one is entitled to entries in the ledger by having the respective private key to unlock such entries.

Asymmetric cryptography, a cryptographic system which uses key pairs composed of public keys (which may be publicly shared), and private keys (which must be kept secret), is another important part of any blockchain. Every single public key is derived from a private key and the latter can be used to access and move a blockchain's native tokens associated with the respective public key. This will be explained in more detail in the next chapter.

Free entry and exit

Another defining feature worth mentioning about a blockchain is openness. A public blockchain (as opposed to a private blockchain, we'll get to that in a moment) is open to everyone, or in other words permissionless. This means that no one can be prevented from downloading a blockchain's source code and have the protocol run on one's computer. This way, everyone can become a node in the network.

At the same time, nobody can be excluded from using a permissionless blockchain. A public and private key pair can be freely created without any hindrance and can then be used to make use of a blockchain's functionalities.

But that is not enough: A blockchain is also defined by its programming code being open source. Each and every developer can take a look at the source code and get this way a first-hand look into the very heart of a blockchain. As a result, anything that a blockchain claims to be can be verified by anyone.

Additionally - and this is just as important, a blockchain's distributed ledger is public by design, giving users the option to thoroughly audit it. Economic variables such as token supply, transaction count and address balances are openly available as on-chain data. In comparison to other institutions, such transparency about a financial ledger's current state is unprecedented.

Carefully designed interplay

As we can see, blockchain technology in its most revolutionary form is consisting of many different parts. While technically speaking, the blockchain itself is just the hashing (act of connecting) of blocks of transactions, many different parts need to come together for a blockchain to unleash its potential. As such, the whole is really more than the sum of its parts. The following points are the defining features of today's leading public blockchains:

  • Concatenation (or hashing) of data: the actual blockchain or timechain
  • Digital signatures enforced by asymmetric public/private key cryptography
  • A database shared on a large number of computers: a distributed ledger
  • Miner incentivization by means of the proof-of-work mechanism
  • Full transparency in a peer-to-peer network thanks to open source software

Because of all of these features, a blockchain can be considered an economic or institutional order that is based on a well-thought-out incentive structure. The many incentives at play make it possible for users, miners, developers and companies to keep each other in check.

Permissionless versus permissioned

Everything that was mentioned up until now are defining characteristics of a public blockchain. The most prominent examples of these are Bitcoin and Ethereum. In addition to public blockchains, permissioned blockchains like private or federated blockchains have emerged in recent years.

As the name "permissioned" suggests, nodes in a private blockchain have been granted access as identifiable participants. In the case of a private blockchain, there's usually a single company acting as the network's central authority and granting or denying access. With a federated blockchain, a consortium of actors is overseeing the network authorizing access. In both cases, only authorized participants can act as validator nodes verifying and validating the blockchain's ledger.

Public blockchains are the true blockchains

The issue with private blockchains? They undermine exactly what a blockchain is supposed to be: decentralized, censorship and seizure resistant, immutable, permissionless, open. Hence it is questionable, if these technological approaches are even worthy of being named blockchains at all.

It is probable though, that reality's course will gradually bury permissioned blockchain in oblivion anyway. They are likely to be befallen by the same fate as Intranets were. While these were touted as a promising technology back in the 90s, they were finally replaced by the open Internet. In the same way, one day public blockchains will have probably made permissioned blockchains a thing of a long gone past.

Whether it be the Internet of communication in the form of the Internet as we know it today or the Internet of value that is being ushered in by public blockchains, information just wants to be free, freely sharable, and openly available.

After all, this is really where a public blockchain makes sense and can unleash its true, revolutionary potential. Centrally handled things like fiat money, finance, and data are the perfect targets for public blockchains to disrupt. Public blockchains truly exist and are made for the disintermediation, deinstitutionalization and dehierarchicalization. In other words: for democratization.

This doesn't mean that incumbent institutions and companies cannot make use of blockchain technology or might even fully disappear because of it. It will mean however, that they will have to adapt and learn how they can profitably use a public blockchain's assurances for good.

Pascal Hügli photo

About the author

Pascal Hügli

Pascal is a moderator, debater and lecturer at the Zurich University of Applied Sciences in Business Administration (HWZ). He advises the bank Maerki Baumann in a mandate as Crypto Investment Manager. As an analyst for the German-language newsletter Insight DeFi, he aims to inform the general public competently and concisely about the events and opportunities of the new decentralized world of Bitcoin and Co. He is also the author of the book Ignore at your own risk: The new decentralized world of Bitcoin and blockchain.

Don't miss our next article!

Subscribe to our newsletter and get the next chapters delivered straight to your mailbox.

SubscribeRight angle white icon