What distinguishes blockchain’s architecture from a conventional database?
Some would say that blockchain is nothing more than an online database protected by powerful data encryption. After all, databases are designed to hold massive amounts of data, and large databases are frequently housed within a secure network of computers, each of which provides the processing power and storage capacity required to keep the ledger running smoothly. Blockchain works in the exact same way.
What differentiates blockchain technology from a standard database is in its structure.
To understand how blockchain works, know that blockchain’s architecture refers to a specific protocol: a peer-to-peer ledger that runs via the internet and is made up of various components, ranging from the database itself, to nodes, networks, and cryptographic protection.
It’s important to remember that blockchain is a protocol rather than a piece of software. Rather than requiring every device to run the same software in order to use the blockchain, all that’s needed is for the devices to communicate using the set rules and structure of the blockchain.
Take, for example, HTTP, the internet protocol that governs how websites work.
The HTTP protocol outlines the framework for encoding information over the internet. When you click on a link to view a video or an article, your web browser sends an HTTP request to the server that is holding the information. The server then provides the required files and content in a format that follows the rules of the HTTP protocol, allowing your web browser to properly read and display the information. If that format is wrong or incomplete, an error message will be displayed and the webpage will not load.
Accessing or even building a website doesn’t necessitate the use of any special software, only that you follow the standard internet protocol. In a similar vein, blockchain technology can be accessed and maintained through a variety of software, such as various web servers (Microsoft IIS, Apache, Nginx etc.), and web browsers like Firefox, Chrome, Safari, and so on. These servers and browsers can communicate with one another as long as they adhere to the HTTP structure.
To run a blockchain protocol, a decentralized network of computers (referred to as ’nodes’) store identical copies of the blockchain ledger on each of their systems, updating the blockchain once a block has been validated on the shared network.
These computers are often remarkably powerful and capable of handling a wide range of complicated tasks. Depending on their roles, some nodes are considered Full, or Partial.
Full nodes maintain an up-to-date copy of all the data on the blockchain. They are capable of validating, accepting, and rejecting data blocks.
Partial or Lightweight nodes don’t keep complete copies of the blockchain ledger. These nodes store only the hash value of a block, and typically have less storage space and processing power than full nodes.
When a block of data is added to the blockchain, it is immediately stored by each node on the network as the devices sync together to maintain a single copy of the database.
It’s clear then that nodes are responsible for keeping the blockchain operational, preserving its accuracy and assisting in the creation of new blocks. However, all nodes are considered equal and no one device runs the blockchain in its entirety.
This creates a public and transparent ledger of transactions — one that is not controlled by a central entity.
The way data is structured in a blockchain differs significantly from most other ledgers and databases.
In lieu of tables, columns, and rows, data on the blockchain is compiled into ‘blocks’, each of which can contain a fixed amount of information.
Once a block is filled, it is chained onto the previous block, forming a data chain known as a blockchain. Any data that follows that freshly added block is compiled into an entirely new block, which is then added to the chain once it is full as well.
To understand how the data in these blocks is kept secure, we need to examine a few key components of blockchain technology below.
Each successive block in the chain is linked to the one before it. To accomplish this, blocks are assigned a unique identifier that allows new blocks to locate and link themselves to the last created block. Transactions for the time frame will be included in subsequent blocks, as well as one additional piece of information: the previous block’s unique identifier.
You may have heard the terms ‘block hash’ and ‘hashing’ thrown around in the cryptocurrency space before. A hash number is a one-of-a-kind alpha-numeric combination that marks a specific block on the blockchain in the same way that a fingerprint marks each unique individual. It identifies a block and all of its contents.
For the block hash to be cryptographically secure, it needs to be near impossible to compute two separate input messages that would result in the same hash function. In blockchain, this is known as collision resistance.
As a result, any data changes within the block will immediately cause the hash number to change. This makes the hash value extremely useful for detecting alterations made to the blockchain, and is part of what makes a blockchain difficult to hack.
When a block is added to the chain, it is also assigned an exact timestamp, which becomes a permanent part of the blockchain’s timeline. This results in the formation of an interdependent and chronological chain of data, which is the strategy underlying blockchain’s architecture.
The importance of hash generation can’t be understated. Each block on the chain will contain not only its own data, but its identifying hash value, as well as the hash of the previous block. If the hash of a block changes, the blockchain would no longer recognize it as the same block, rendering every ledger with a copy of that block invalid.
To illustrate this: let’s say we are given a chain of four blocks.
The hash value of all these blocks is generated using the Secure Hash Algorithm 256 bit (SHA-256), a popular cryptographic approach. The genesis block, or the first block in the chain, is block 1. Following the genesis block, all subsequent blocks will contain the hashes of previous blocks. So, the hash number of block 1 would be in block 2, the hash of block 2 is in block 3, the hash of block 3 is in block 4, and so on.
If we assume an attacker is able to change the data present in block 2, thereby changing the hash value of that block, block 3 will still retain the accurate block 2 hash. As a result, block 3 and 4 and all other subsequent blocks would be rendered invalid, signaling to the entire network that an alteration in block 2 has been made.
In the event that a blockchain is hacked — a near-impossible task in and of itself — the hacker would have to change the targeted information and, within seconds, recalculate and alter the hash value in every subsequent block, without setting off the entire network.
Hashes are a useful tool for preventing blockchain attacks, however modern computers are capable of calculating large amounts of hash values per second. A dedicated attacker can tamper with a block and, using a powerful computer, recalculate all subsequent block hashes in minutes, restoring the blockchain to its original state.
Proof-of-Work is a consensus mechanism that blockchain technology uses to circumvent this problem. A proof-of-work problem requires that members of a network expend a certain amount of time and effort to solve a computational puzzle before submitting data to the blockchain. Doing this slows the creation of new blocks to a predetermined rate.
The proof-of-work calculations required to add a new block of transactions in Bitcoin, for example, are designed to take ten minutes. In this scenario, a hacker who wanted to change the data in a block would have to first perform proof-of-work on the targeted block (which would take 10 minutes) before making the necessary modifications to all subsequent blocks, performing the 10-minute proof of work calculations each time.
Rather than depending on a single institution to run the ledger, blockchain technology takes a different approach to security, eschewing the control of a central authority and instead utilising a decentralized peer-to-peer network that anyone can join. Anyone who joins this network receives a complete copy of the blockchain up to that point.
When a user adds a new block, it is distributed to all other users on the network. Each node must verify the block to ensure that it has not been tampered with, only adding it to their own copies of the blockchain after it has been thoroughly authenticated. Any falsified blocks will be rejected by the network.
All the nodes in a network must agree on which blocks are authentic and which are not. This is central to how blockchain technology works to keep the ledger secure.
To successfully hack a blockchain and ensure that an altered block will be accepted onto the blockchain, you would need to alter every block on the chain, redoing each block’s proof-of-work to generate new hash values — before seizing control of more than half the decentralized network in order to distribute the falsified ledger and maintain network consensus. This structure makes blockchain very difficult to tamper with, to say the least.
All these components remain key features of the original blockchain architecture on which Bitcoin is built, and while Bitcoin has its own history, its blockchain protocol now serves as the foundational architecture for blockchains in general. If the structure seen above isn’t present, then the ledger may still be considered a database, but can’t rightfully be called a blockchain.