The comparison between blockchain technology vs database can be a curious thing for developers but in general, it’s not very clear for laypeople. Strictly speaking, blockchains are databases. Ethereum is powered by LevelDB while EOS is powered by MongoDB, which is a very common database for web developers.
While a blockchain is a database, a database is not necessarily a blockchain. In this article, I will explain why and will examine three major differences between a centralized database (usually a relational database) and a distributed database (blockchain), and where we recommend either the use of a database or a blockchain technology.
Blockchains versus databases — What’s the difference?Table of contents:
Centralized versus decentralized
In a nutshell, a database is a computer program that can store, manipulate and retrieve data. The data itself can range from numbers and texts to more complex structures.
Traditional databases are centralized (they physically run on one server and users can’t download them) and are highly secured because they often store critical user and business data. As such, it makes sense that only a limited number of entities can directly manage it — system administrators or devops engineers or interact with it — the backend of a web application.
Public blockchains, on the other hand, do not have a centralized structure, where only a limited number of people manage the data or defines the rules of management in an application.
Because blockchains are not owned by a specific entity, the data itself is distributed across the whole network and any participant of the network can download it. This is possible due to the fact that network users can’t directly modify the blockchain. They have to rely on the consensus algorithm that governs the blockchain. As a reminder, a consensus algorithm is an algorithm that defines under which conditions data can be added to the blockchain.
For example, Bitcoin and Ethereum use proof of work in which computers lend their computing power to compete to solve mathematical puzzles. EOS and Lisk meanwhile use delegated proof of stake where real-time voting combined with a social system of reputation work to reach consensus.
While the consensus targets how new data can be added to the blockchain and how it can be verified, decentralization describes the fact that the blockchain is not physically owned by one entity. Concretely, this means that the database is not running on a single server owned by a single entity. The blockchain is replicated across any computer that wants to download it.
A private blockchain network, allows access only to selected and verified participants. For example, within one organization that has decided to use a blockchain network. In the case of such a permissioned blockchains – a participant can only join after receiving an authentic and verified invitation, and must then be verified by the relevant authority using the appropriate protocol.
The most noticeable differences between blockchain that is public or private is that the access to it is being controlled.
A private blockchain is therefore not decentralized to the same extent as a public blockchain, but is a distributed ledger that operates as a closed, secure database. Not every participant can modify data or approve changes to such blockchain. So that private blockchain has way more in common with traditional databases if to compare with public blockchain network without any form of central authority.
Permission versus consensus – blockchain vs database
While blockchains rely on the concept of “consensus,” traditional database rely on permissions and central authority.
In a database management system (DBMS), the administrator can define “users” that can communicate with the database. The term users is broadly defined — it can be a person but also an application. For instance, the backend of a web application that checks if a person is trying to access certain information has the right to do so.
Traditional centralized databases limit the number of users by design and have no need for a consensus mechanism. Think of a database like a group of people where the administrator is the leader. He will have the right to determine which users can access the database and modify it.
A typical public blockchain database on the other hand does not rely on an administrator or on permissions. It relies on the consensus.
Among other things, a blockchain architecture is typically made of the database layer, that stores information, and of the application/rules layer that governs how data can be added to the database. These rules are called consensus. However, all consensuses are not the same. Some are more centralized like proof of authority while others are more decentralized like proof of work and proof of stake.
Blockchains themselves can be public or private. In a nutshell, anyone can create blocks in public blockchains as long as they comply with the consensus algorithm. Main difference between blockchain that is private and public is that private blockchains are usually more restrictive and are used in organizations and corporations that need to limit network participants for privacy or trade secrecy. Usually both private and public chains can be downloaded and queried.
While the blockchain is a very interesting technology that allows triple entry accounting and trustless applications, it comes with associated downsides. GDPR and data privacy does not work well with a publicly accessible blockchain solutions. Moreover, the public key cryptography that blockchain uses relies on the user side security. That means that users need to protect and secure their key pair.
Append-only by design
Finally, blockchains differ from traditional databases by the fact that blockchains are append-only. That means that new data does not replace old data, it gets tacked onto the database in such a way that there is a historical track record of all the changes. This is not the case in traditional relational databases where new data replaces old data unless it has been specifically programmed to do otherwise.
This happens because blockchains organize data in blocks, defined by a timestamp and by the hash, a signature, of the previous block of data. This allows the data to be linked through time and provide a record of changes in the blockchain.
This functionality can be implemented in traditional databases (e.g. transaction history in banks) but are definitely not critical and are not a built-in feature. However, it is critical for blockchains that rely on a historical chain of transactions.
Conclusion – blockchain vs database
As we’ve seen above, while blockchains are databases, the use cases where blockchains can be useful are totally different from traditional databases that rely on a centralized entity. Blockchains follow the idea that a system can be governed without a central entity such as a corporation or a country.
As such, there are many use cases, and very often some form of centralization is needed (financial regulations, compliance, GDPR, etc.). That’s why it is essential to weigh for each and every application the pros and cons of using a decentralized or centralized system.
- Essential blockchain development tools to make your job easier
- 8 no-nonsense blockchain use cases for 2022
- What are smart contracts and what makes them so smart?
- Blockchain use cases in fintech
- Why frontend developers should care about blockchain UI.