Blockchain has been tied at the hip with cryptocurrency since its inception. Blockchain is the technology on which cryptocurrency is built. It is designed to promote transparency and meet the demand for centralized management. Technically, you can build a cryptocurrency without using blockchain, but that’s a discussion for another day.
But blockchain isn’t just for cryptocurrency. You can exchange anything using blockchain technology, from virtual currency to digital assets such as non-fungible tokens NFTs. Due to its versatility, blockchain is being adopted in an increasingly wide range of industries and disciplines.
A blockchain is technically a database, but a database is different from a blockchain-based database. In this tutorial, we’ll introduce you to the concept of a blockchain-based database and evaluate some of the top database solutions currently available to blockchain developers.
Here’s what we’ll cover:
- What is a blockchain-based database?
- Blockchain vs. traditional database
- How to choose the right blockchain-based DB for your project
- Top 7 blockchain-based databases
What is a blockchain-based database?
Blockchain is a distributed database of records or public ledger of transactions that have been carried out on the network.
To paint a picture, let’s say that four business partners, Alice, Bob, Tom, and Hardy, are starting a chain of stores. Each of them owns one store and they have four stores in total. The partners decide to store the profits and sales made from each store in a database (e.g., MySQL).
The database is vulnerable to any of a number of potential snafus, included but not limited to the following.
- The database could be compromised by a malicious actor
- Due to its centralized nature, a crash or failure of the database would affect all records
- A malicious or unwitting actor could alter records in the database
- An authorized party could enter records into the database without validating its authenticity
- One partner might accidentally alter or delete data entered by another partner
Considering the myriad security risks, Alice, Bob, Tom, and Hardy wisely opt to use blockchain technology in their database.
Now each partner has a copy of the records or the database. If a record is entered into one database, it is broadcast to all the others, which must vet the record before it is entered into the user’s record. Once it is vetted by all the participants, then the record is entered into the user’s database and the new copy is sent to all of them in the node.
Using blockchain has made the team’s work:
Blockchain vs. traditional database
Blockchain-based and traditional databases are similar in that they both store information but differ in terms of functionality. A blockchain-based database complements the functionalities and features of a traditional database.
Put simply, every blockchain is a database, but every database is not a blockchain. The decentralized nature — and, of course, the underlying blockchain tech — is what separates blockchain-based databases from traditional databases.
A blockchain is a digital ledger that stores data in blocks. These blocks are decentralized and broadcast across all nodes in the network. A traditional database, whether an RDMS or NoSQL databases, is also used to store data.
The obvious similarity here is that both blockchain-based and traditional databases are used to store and hold information. They both can store any type of data, be it binary files, media files, text files, and so on.
A traditional database is centralized, meaning there is a central administrator that has control over the database. Many sites and apps that we use every day use traditional databases. Twitter, for example, controls the database in which our tweets are stored. As the administrator of the database, Twitter controls what we see; should Twitter decide to shut down one day, we can kiss our tweets and files goodbye.
With blockchain, the database is not central and there is no administrator. It’s a peer-to-peer network, just like Napster. Everyone is connected to the network and each node in the network has a copy of the current database.
When a node in the network wants to write or create a new record in the database, the node first creates the record and broadcasts it to all nodes in the network. All these nodes then use a consensus algorithm to vet the new record.
If the vetting process by all nodes is successful, the node writes the record to its database and broadcasts it. Then, each node in the network writes the record to its respective database so the state and records are consistent and up to date.
This makes data stored in a blockchain very difficult to tamper with or duplicate. It’s transparent because all nodes vet each record that is to be entered into the database.
To recap, blockchain-based and traditional databases are both used store information but they differ in terms of functionality, as shown in the small table below:
How to choose the right blockchain-based DB for your project
How do you know when to use a blockchain-based DB and when to use a traditional database for your project? Let’s go over some primary considerations.
Cost is one of the most important things to consider when deciding which type of database to use for your project.
Because the old-school way of storing data is still very popular, the cost of using a normal database is much lower than the costs associated with blockchain. The expense of building a blockchain and integrating it into your project is comparable to that of normal software development.
If you decide to use blockchain, you’re about to experience the most robust and fault-tolerant DB you can imagine. Because a traditional database is centralized, it can be hacked and tampered with.
More great articles from LogRocket:
- Don't miss a moment with The Replay, a curated newsletter from LogRocket
- Learn how LogRocket's Galileo cuts through the noise to proactively resolve issues in your app
- Use React's useEffect to optimize your application's performance
- Switch between multiple versions of Node
- Discover how to animate your React app with AnimXYZ
- Explore Tauri, a new framework for building binaries
- Advisory boards aren’t just for executives. Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Blockchain, on the other hand, is very difficult, if not virtually impossible, to compromise. So if you have sensitive data to store and require a database with high fault tolerance, blockchain is your best bet.
Most modern databases have been designed to achieve high performance. SQL and MongoDB, for example, are very fast off the shelf. Reads and writes are very performant without any optimization by the administrator.
Blockchain is quite the opposite. Writing to records in the blockchain is relatively slow due to the many checks and run-arounds that have to occur in the blockchain core before a record can be written to the database.
If high-speed performance is a priority, you should use a traditional database instead of a blockchain.
Security is a major consideration in any business. The data in a blockchain is viewable by anyone who intends to look. But you may have good reasons why you don’t want your data to be public.
Fortunately, blockchain has evolved to the point that you can use the blockchain network privately within your selected nodes. Traditional databases can also be both made and used publicly and privately.
Blockchain cryptographically hashes the transactions in its blocks and each block forms a linked chain with one another. This gives it a high degree of transparency because no node or client can fault or dispute a record.
Top 7 blockchain-based databases
Now that we understand the difference between blockchain-based and traditional databases, let’s look at some of the most popular blockchain-based DBs in use today.
BigchainDB is a blockchain-bassed database powered by MongoDB that enables you to add decentralized and blockchain technology to your application.
First announced to the world in February 2016, BigchainDB v0.1 was originally a traditional database until the development team later added blockchain features. It had some issues at first. Namely, it had a primary node that did all the writes and broadcasts to other nodes. The other nodes just read from this primary or master node.
This primary node was the database’s single point of control, which violates the golden rule of blockchain. When the database is altered, all other nodes see the unvetted changes.
Version 2.0 patched up all these holes and made BigchainDB the most sought-after blockchain database in the world. BigchainDB’s superb features include the following:
The records stored in BigchainDB are tamper-proof. The records are immutable, meaning that once a record is verified and stored in the database, it can never be altered or changed.
The database is decentralized in a P2P network. There is no single point of command. Each node in the Bigchain network has a local copy of the MongoDB database, and it uses Tendermint for network and consensus protocols.
One advantage of using Tendermint is that it uses Byzantine fault tolerance (BFT), which enables the blockchain to agree on what the next block will be, even if up to half of the nodes in the network are faulty. So if a hacker gains access to one of the node’s MongoDB databases, the network can remove that particular database and still function.
Support of multiple assets
Assets of various types can be stored in the database. The users in the nodes can issue any assets in the Bigchain network.
According to BlockchainDB, an asset can characterize any physical or digital object that you can think of, such as a car, a data set, an intellectual property right, etc.
BigchainDB was built with performance in mind. The use of Tendermint makes it possible for BigchainDB to achieve high performance.
Tendermint takes only a few seconds to process large transactions and commit them to a new block. This flies in the face of the notion that committing transactions in a blockchain takes a whole lot of time.
BigchainDB works very well in many scenarios, notably in supply chain stores, where there is a need to organize data and provide immutability and transparency.
Apache Cassandra is an open-source NoSQL distributed database that delivers linear scalability and high availability without compromising performance.
First released in 2008 and written in Java, Cassandra can handle large amounts of data across many commodity servers, providing high availability with no single point of failure.
Cassandra partitions rows, and each row contains tables that have a required primary key. With this partitioning, Cassandra can distribute the rows across multiple networks and devices. It adjusts across the network when rows and partitions are removed and added to the network.
Cassandra has many notable features that make it a unique blockchain-based DB.
There is no central node or single point of control in Cassandra. The rows and partitions are distributed across the cluster. There is no master cluster because every cluster is both client and server and identical.
Because it is distributed and has no single point of control, Cassandra is fault-tolerant. That’s because every node in the cluster has a copy of the database, so if one node in the cluster is attacked, the whole system does not come down. The data in the collapsed node is still in the other nodes in the cluster, so the data is safe.
Cassandra’s structure is quite similar to SQL in that it has rows, tables, and columns. However, Cassandra does not use the SQL language for querying data. Instead, it has its own query language, Cassandra Query Language (CQL).
ChainifyDB is a blockchain solution for databases. It provides a layer in which databases can be plugged into the ChainifyDB network and synchronizes the databases’ records within the network of plugged databases.
Once a record is entered in one database, ChainifyDB communicates the addition to all other database nodes. They agree on a certain consensus and the record is written to the databases, so the records are decentralized, immutable, and transparent.
The difference between ChainifyDB and other blockchain-based DBs is that each block has its own database/storage area. ChainfyDB does not have its own database; it uses the databases provided to it and plugs a blockchain layer into them. In other words, ChainifyDB provides a blockchain layer for already existing databases.
Let’s zoom in on ChainifyDB’s unique features.
Communication between the plugged databases in the ChainifyDB network is highly encrypted.
The core vitals, components, and maintenance setup of chainifyDB can all be run from a web frontend. Unlike other DB solutions, it does not require a lot of tools to set up.
The ChainifyDB can be seamlessly connected or plugged into any data stores or databases without affecting the applications running on the databases.
As legend has it, co-founder Auxten Wang first conceived of CovenantSQL in 2017 on “a cold windy day when Jing Mi came to have dinner with me in a BBQ restaurant. He brought me an interesting idea to build a SQL database on Blockchain. I was excited about this idea and decided immediately to quit my job and start this project.”
CovenantSQL is a blockchain SQL database. According to the official website, CovenantSQL connects idle storage resources utilizing consensus protocol and aims to better facilitate DApp development with full SQL support.
CovenantSQL provides an infrastructure on top of which to build decentralized apps, just like Ethereum. Among its many use cases, CovenantSQL can be used in assets management and integrated into IoT solutions.
CovenantSQL has many awesome features. Let’s highlight a few.
Just like the blockchain tech it implements, CovenantSQL is largely decentralized across a P2P network. This makes it fault-tolerant and ungovernable by a single entity.
SQL is the most widely used and popular database query language in the world. CovenantSQL uses it because of its popularity and the possibility to add extra blockchain leverage to it. SQL support makes CovenantSQL a blockchain-based DB to contend with.
CovenantSQL’s blockchain makes the database to immutable. All records coming in must be vetted by all nodes in the network before committing to the database.
CovenantSQL provides an infrastructure where developers can build decentralized apps on top of it. It is just like what we can do on Ethereum. CovenantSQL can be used in assets management and also can be integrated into IoT solutions.
5. Modex BCDB
Modex Blockchain Database (BCDB) is a middleware software product that provides a plug-and-play approach for organizations that want to develop blockchain software.
Modex BCDB sits in the middle between the client application and its database. The approach is different from other blockchain DBs. It plugs into the DBs and modifies their connectors, providing a blockchain layer between them.
Modex BCDB has a wide range of features, which we’ll break down below.
Multiple blockchain support
Modex BCDB is flexible in that it can use other blockchain frameworks. It currently uses the Hyperledger Sawtooth framework and using the Tendermint protocol in its network and consensus protocols. Other frameworks Ethereum, and Hyperledger Fabric can be used too.
Multiple database support
Modex BCDB supports multiple databases. A node can use MongoDB while another node can use MySQL, Modex BCDB can seamlessly work and sync data with them without any configuration any porting to a supported database.
Modex BCDB can manage data perfectly without any compromise to security. Modex BCDB knows when and which node it can expose some or all data to. A full node in the Modex BCDB network is exposed to the whole data, a partial node is only exposed to data that its APIs requested, and a private node is exposed only data private to it and no one else.
|SQL, NoSQL||Proof of stake|
Postchain is a blockchain platform developed by Chromeby in Sweden. Postchain is a blockchain framework just like Ethereum or Hyperledger; it has a network of nodes that maintain a set of data through a proof-of-authority consensus algorithm.
Postchain stores this data in an SQL database, which is different from all other blockchain frameworks. Also, Postchain’s transaction logic can be defined in SQL code. This is what makes Postchain a blockchain-based database.
Transactions are not written to the database via SQL code. Postchain has validators that work on every node in the Postchain network. Transactions are submitted via highly encrypted and signed messages. The validators pick up the messages and run in sync to validate the proof and source of the messages. This sync is done so that all the nodes in the networks have the same state in their databases.
According to CTO Guy Harrison, ProvenDB is a blockchain-enabled database service layered on MongoDB.
ProvenDB is a database service that combines MongoDB database with blockchain characteristics. By using ProvenDB, you are using a MongoDB database with blockchain.
Among its most important features, ProvenDB delivers:
- A tamper-resistant digital data store
- An immutable data store; once a record is entered into the ProvenDB database, it can never be altered, edited, or deleted. It remains “pinned” in the database
- A highly secured blockchain database you can use to store all kinds of sensitive data, such as financial records that are resistant to alteration, intellectual property, legal documents, public records, and more
ProvenDB is a good choice if you want to use MongoDB and also leverage blockchain in your applications. ProvenDB provides a REST APIs you can use for making tamper-proof transactions and storing documents.
ProvenDB provides a secure database for data engineers that is encrypted and tamper-proof. No wonder it has been recognized by such a wide range of major companies, including Toba Capital, Microsoft, RegTech, CRN, and more.
Blockchain is evolving rapidly. It started with the bitcoin craze and now the whole world is starting to see the awesome power blockchain wields across a wide variety of industries. There are so many blockchain-based databases, but the seven mentioned above stand apart for their popularity and breadth of features.
In this guide, we introduced you to blockchain at a high level and zoomed in on the concept of blockchain-based databases, including the similarities and differences between traditional databases and blockchain-based databases.
We then offered some tips on how to choose the best blockchain-based database for your project. Finally, we evaluated seven of the top blockchain-based databases and discussed in detail how they function, their use cases, and their superpowers.
LogRocket is like a DVR for web and mobile apps, recording everything that happens in your web app or site. Instead of guessing why problems happen, you can aggregate and report on key frontend performance metrics, replay user sessions along with application state, log network requests, and automatically surface all errors.
Modernize how you debug web and mobile apps — Start monitoring for free.
One Reply to “Top 7 blockchain-based databases”
Great stuff! If you need full SQL access to any blockchain with a blazing fast API to pull the data into a Jupyter Notebook, check out Luabase at https://luabase.com/.