Difference between a database and a blockchain
Following is the basic difference between a database and a blockchain
A database is an organized collection of information that can be easily accessed, managed and updated.
Data is organized into rows, columns, and tables, and it is indexed to make it easier to find relevant information. Data gets updated, expanded and deleted as new information is added. Databases process workloads to create and update themselves, querying the data they contain and running applications against it.
Databases are highly centralized as they are owned by a designated authority which lays down the conditions for clients to have access to the database. However, if the security of this authority is compromised, the database can be altered or even destroyed at the mercy of the hacker.
On the other hand, a blockchain is a chain of blocks containing data. In a blockchain database, the control is decentralized and is spread amongst various nodes (participants) in the network. All these nodes reach a common consensus using a consensus algorithm to decide which block is to be appended to the chain. This consensus protocol makes the data immutable and difficult to tamper.
Different blockchains can use different consensus protocols such as Proof of Work (used by Bitcoin), Proof of Stake (used by NEO) etc.
There are several concerns and points to be noted pertaining to both the database types:
CRUD vs Read and Write operations
Traditional databases, provide the client with four main operations – Create, Read, Update and Delete, also known as C.R.U.D. A user can change any information in the database as long as he has proper access given by the authority. On the other hand, blockchain does not allow nodes to update or delete information. The data in the blocks is immutable which means that it cannot be changed. For example, if someone sends me 100 Bitcoins, it will be recorded in the blockchain permanently that my wallet contains 100 BTC. If I then spend 50 BTC, then this transaction will be recorded on the blockchain too. However, the catch is that my balance before the transactions, i.e. 100 BTC will also remain on the blockchain. In a traditional database, this information can simply be edited and my balance would be updated to 50 BTC rather than keeping both the values at different time stamps.
Any person retrieving data from the blockchain can be sure that the data is authentic and has not been tampered with due to the design of the blockchain. However, the same kind of confidence is not there with a traditional database as it is possible to gain unauthorized control and edit/delete entries.
Traditional databases, as mentioned, require clients to gain access from the authority. Public blockchains like that of Bitcoin or Ethereum are open for any to read and write information to. However, there is one more kind of blockchain which is called the permission blockchain.
Like a traditional database, the access to permission blockchain is limited and is given by the network creator. Nevertheless, if trust between the nodes is not a major concern, permission blockchain may only prove to be time-consuming and more expensive to maintain.
When it comes to confidentiality, a traditional database can work as good as a permission blockchain. Instead of providing extra cryptography to secure the information on the blockchain it is much better to store the same information in a completely private database.
The blockchain is inherently more robust than traditional databases. This is because of the presence of multiple users in the blockchain network who have the capacity to validate transactions and maintain the blockchain. Consequently, a blockchain can handle hacks and attacks more effectively as no attack can possibly shut down the whole system from functioning and processing transactions.
However, when it comes to the traditional database, it is unlikely that they will be able to achieve such a level of fault-tolerance.
Thus if you are looking for a tough database which can stand against attacks, you might want to use blockchain.
Performance is one of the major drawbacks of the blockchain. The reason that blockchain requires all the nodes to reach a consensus delays the process of adding new blocks. In addition to that, famous blockchains like the bitcoin blockchain use the Proof of Work consensus algorithm in which a new block is added every 10 minutes. Though other blockchains like Ethereum can achieve this within 12-15 seconds, it is still slower than traditional databases which can do this almost instantly. Moreover, with blockchains like that of bitcoin, there needs to be an incentive for miners to validate transactions, without which, no one would add blocks to the blockchain.
Thus in this regard, a traditional database will be a better choice as it can also scale as the requirements increase, unlike the blockchain, the scaling of which is still debatable.