Blockchain vs. Traditional Database
We know that blocks within a blockchain store data. So, will it be wrong to say that blockchains are technically databases?
If we consider all that we have learnt about blockchains so far, we can say blockchains are quite sophisticated and complex. However, at the bottom line, they are not that complex. They are just like databases but are structurally and functionally different. While databases store data using ‘table’ data structures, blockchains store data in blocks. So, what makes blockchains different from data structures?
The answer is simple. To have a clear understanding, try to comprehend the picture that follows this statement.
While traditional databases are centralized, blockchains are not. They are decentralized.
Every blockchain may be considered as a database, but not database can be considered as a blockchain. Here’s why.
A blockchain is kind of a database because it is a digital ledger that stores information in data structures called blocks. On the other hand, a traditional database is a data structure used for storing information.
Databases first started as flat file hierarchical systems that provided digital storage for simple information gathering. In due course of time, databases incorporated and leveraged a relational model which allowed more complex ways of gathering data by relating information from multiple databases. A database can be modified, managed, updated and controlled by a single user called an administrator. This is where central control comes in. A database always has an Administrator who has complete control of the database. This user can create, delete, modify and change any record which is stored in a database. Admins can also perform administration on the database such as performance optimization and moulding the size of the database to more manageable levels. A large database generally tends to slow down the performance index, so admins run optimization methods to improve performance of the database.
A database also is recursive, meaning that if you want to go back to repeat a task on a record and modify or delete it, you can do it if you have the authority. Often, admins remove old records from a database that are backed up already or have been deemed as containing obsolete and useless information.
While a traditional database is centralized, a blockchain functions differently. A blockchain stores information in blocks that are uniform in size. Each block contains the hashed information or hash code from the previous block to provide cryptographic security. Unlike databases, this added security feature engrossed within blockchains makes them extremely difficult to hack and tamper. The hashing uses a SHA256 mechanism which predominantly a one-way hash function. The hashed information is the data and digital signature from the previous block, and the hashes of previous blocks that goes all the way back to the very first block or the genesis block in the blockchain. That information is run through a hash function that further points to the address of the next block.
PS- Remember linked lists? Blocks in a blockchain are connected in the same manner as nodes are connected in a linked list.
The main differences between blockchains and databases are listed in the table below.
What is the difference between a relational database and a blockchain?
1. Decentralized Control: Generally, blockchains allow different parties to share information with each other without requiring a central administrator. The consensus mechanism that we discussed earlier plays a big role in decision making in case of blockchains. Although, databases have a completely different usability. A central administration is required in a database as certain situations arise where you cannot depend on a consensus. Sometimes, basic intellect of one individual may turn out be better than the combined intellects of a zillion other individuals.
2. History of Itself: Centralized databases record present information only. They do not trace information that was previously recorded. With blockchains, the case is different. They not only keep information that is relevant in real-time but also can trace back information of transactions that have come before. Blockchains can create databases that have histories of themselves, meaning, they grow like ever-expanding archives of their own history.
3. Performance: While blockchains are used as systems of record and are ideal as transaction platforms, they are considered slow as databases when considered for digital transaction technology. There will certainly be improvements to the performance and nature of blockchain technology, no doubt, but databases are offering the same anyway. They have been around for decades and have witnessed their performance surge in multi-folds.
4. Confidentiality: A permissioned blockchain, like a centralized database, can be both write and read-controlled. But, if confidentiality is the only goal, blockchains have no advantage over centralized databases.
Based on emerging use-cases, many more differences can be jotted down between centralized databases and blockchains. Both are different and will always remain different.
Originally published at www.intellipaat.com on February 22, 2019.