How does a blockchain database work

Internet What is a blockchain?


Blockchains are perhaps the biggest tech trend at the moment. And you are probably familiar with at least one application: the cryptocurrency Bitcoin. But what else can blockchains do? And above all: how do they even work? Here you will find a clear overview:

Blockchains are distributed databases

Basically, blockchains are nothing more than databases - storage for huge amounts of data. The main difference to a Microsoft Access database, for example: The Access database is available locally as a single file, the blockchain database is distributed across a network. This is a completely normal peer-to-peer network, as known from file sharing via eMule & Co., which was popular in the past. However, with the difference that, as a rule, all data is with all users. As soon as you install the Bitcoin client, for example, the Bitcoin blockchain is synchronized with over 70 gigabytes on your computer. And so the first advantage is clear: the database cannot simply be deleted!

And another difference: Databases like Access store any type of data. Blockchains can do that too, but are primarily designed for transactions. Blockchains are often referred to as ledgers. The term comes from accounting and describes the central register with all cash flows of a company. And so the blockchain also primarily manages transactions. In the case of cryptocurrencies, a data record usually simply consists of the sender, recipient and amount; there is also metadata such as the time. It could just as well be saved where, for example, fishery products are currently located: the sender is the sea, the receiver is the cutter and the amount of the catch. In the next step, the cutter would be the sender and, for example, the factory in the port would be the recipient of the catch. It could go further with the factory as the sender, a truck as the recipient and filleted fish as the amount. So you could always see where a catch is or was. All these fish transactions can now be combined in a so-called block and attached to the existing chain of blocks - nothing else is a blockchain.

In practice, in the supermarket, for example, you could see exactly where a canned fish comes from - and with a look at the blockchain you could prove that this is actually true. Because blockchains are not that easy to manipulate.

Secure through cryptography

The really great thing about blockchains is this security against manipulation. And this happens in two ways: On the one hand, the participants in the network must agree that each newly added block is a correctly structured data record - they have to establish consensus. So it is not possible to simply attach a manipulated block with fabricated transactions. On the other hand, the blocks, the name already suggests, are linked to one another so that the blocks cannot be changed afterwards.

Let's start with the simpler concatenation. A block consists of the actual user data and cryptographic data that are supposed to ensure the integrity. To put it simply, you can think of it this way: A new block contains a value that was derived from the data of the previous one. This value, also called hash, is calculated using cryptographic means and is therefore practically unique. And this hash is also used when calculating the next hash for the next block. If you were to change a block somewhere in the chain, its hash would also have to change in the following block - and its in its successor and so on.

Establish consensus in the network


More complicated is the question of how a new block is appended to the chain. This is about the so-called consensus algorithm. The keyword you may know from the Bitcoin world is mining. When working with blockchain data such as Bitcoins, as already mentioned, transactions occur that are summarized in blocks and attached to the chain. And if you attach the block, you will be rewarded with Bitcoins in this case. Who this is cannot be predicted - and thus manipulated blocks cannot easily be added to the end of the chain.

This mining takes place in a very simplified way in two steps. On the one hand, it is checked, but the block compiled by a miner is formally correct. On the other hand, there is a competition among the miners to determine who can contribute the block. In this case, the person who is the first to solve a cryptographic puzzle is allowed to do so: If you use any cryptographic method such as SHA256, a specific hash is created for the block. Now the task can be to calculate a hash for the block that is smaller than a certain value, i.e. starts with four zeros. In order to get a different hash, something has to be changed in the block data. The transaction data and the hash of the previous block are of course taboo - so you add a short string of characters to the block. The only purpose of this so-called nonce is to change the hash value of a block so that it starts with four zeros.

This consensus algorithm goes by the name Proof of work, because the solved puzzle proves that you have put effort / work done. Solving the riddle requires computing power, which in turn consumes electricity - a lot! Entire countries could be supplied with the annual consumption of the Bitcoin blockchain. In the early days of Bitcoin, this mining was also worthwhile for private users on normal hardware, today there is special hardware and associations of miners (mining pools) - so it has been professionalized. This goes hand in hand with the fact that the big miners naturally have an influence: instead of hundreds of thousands of private miners, a handful of professionals now determine the Bitcoin universe.


Proof of work will not survive much longer in this form, the power consumption is simply not acceptable and in the long term it is better if private users can also participate on an equal basis. There are all possible alternatives to Proof of Work, but the only important thing is a basic understanding of consensus algorithms: Blockchain participants use a (practically) non-manipulable process to produce new blocks and take part in a kind of lottery that allows the winner to win his Add a block as a new component of the blockchain. He is rewarded for his effort.

More than just money: smart contracts

However, cryptocurrencies are not the only use for blockchains. For example, the fishing example above is an actual application. Banks and international consulting firms are planning to use the technology for the internal transfer of digital goods, Toyota is using the tamper-proof data in the context of autonomous driving, and there is a lot of discussion about its benefits in the medical field as well.

The next stage is then smart contracts, such as those running on the Ethereum blockchain. In very abstract terms, these clever contracts can automate transactions according to certain conditions. A simple example: You bet a friend for five euros that heise will publish the word "X-Mas" on its homepage on December 24th, 2017. This simple contract could be implemented as a smart contract so that an app automatically checks on the 24th whether the word can be found on heise and, depending on the outcome, transfers five euros (in bitcoins) from you to your friend or vice versa. By the way: Instead of an app, it should actually be called Dapp. The D for distributed means that the app does not run on a single server, but in the P2P network. So you don't need a trustee to manage the money (and charge fees for it). And once set up, no one could unilaterally withdraw from the contract.


With such a simple bet, it's not really interesting - but insurance and stock market transactions are ultimately nothing more than bets. And since blockchains cannot be manipulated (well, should be), such larger bets and other transactions can also be automated and thus made cheaper and, in certain respects, safer. Of course, such blockchains do not necessarily have to be public, they can also be set up in-house.

If you want to look out for specific tools, here are a few recommendations: On the one hand, there are the large blockchains that anyone can use for any data, applications and smart contracts, especially Hyperledger (IBM, Linux Foundation) and Ethereum - both with the potential to turn the IT world upside down. On the other hand, there are of course also the classic small programs for the desktop, with which you can set up a blockchain in private - provided you have a lot of patience and fiddling: Openchain ( and MultiChain ( are both free and allow the use of a private blockchain with relatively little effort. If they work - blockchain is still a very young technology.