Home Audience Developers An Introduction to BigchainDB, a Popular Blockchain Database

An Introduction to BigchainDB, a Popular Blockchain Database

0
5674
BigchainDB_Featured image

Blockchain technology provides decentralised digital public records of transactions that are secure, anonymous, tamperproof and unchangeable. It allows transactions without the need for any centralised authority. However, blockchain technology requires a powerful database, and this is where BigchainDB comes in. This article explores all aspects of it.

BigchainDB is a scalable database that allows developers and enterprises to deploy applications with blockchain characteristics. It combines the best characteristics from blockchain technology such as decentralisation, Byzantine fault tolerance, immutability, owner-controlled assets as well as high transaction rates, low latency and scalability from the distributed database domain. BigchainDB uses Tendermint to obtain the features of blockchain technology and an open source database called MongoDB for storage purposes. Currently, its stable software release version is BigchainDB 2.0.

BigchainDB = Tendermint + MongoDB

Key features and real-time use cases
BigchainDB is widely used in production environments in various real-time applications such as data governance, identity management, supply chains, financial ecosystems and IoT. The key characteristics of BigchainDB are highlighted in Table 1 and described below.

  • Full decentralisation: No single entity controls the network. Every node has its own local-stored list of the public keys of other consortium members.
  • Byzantine fault tolerance: Up to one-third of the nodes in the network can experience arbitrary faults and the rest of the network will still come to a consensus on the next block. In BigchainDB, Byzantine fault tolerance is achieved using Tendermint protocols.
  • Immutable storage: In BigchainDB, if a node gets corrupted or some data is changed, then it is detectable. Because, every node has a local copy of the MongoDB database and transactions are cryptographically signed.
  • Owner-controlled assets: BigchainDB allows users to create their own private network with custom assets and required permissions.
  • Query engine: Each node has its own local MongoDB database resulting in powerful query functionality.
  • Low latency: All the communications between nodes are completed using Tendermint protocols and thus can process a large number of transactions per second.
  • Open source: Being open source with full community backing, everyone can use it and build their own application on top of the BigchainDB stack.

Key differences between MySQL, a traditional database, and BigchainDB
Traditional databases like MySQL provide centralised systems that cannot satisfy the requirements of blockchain networks. This is where BigchainDB is used. The key differences between traditional databases like MySQL and the BigchainDB blockchain database are shown in Table 2.

Features MySQL BigchainDB
Purpose Used for data warehousing,
logging and e-commerce
applications
Used for blockchain technology
Database model RDBMS JSON
Licence Open source Open source
Data schema Yes Schema-free
Performance overhead Bottlenecks can occur
with high traffic
Bottlenecks cannot occur
Accessibility Limited access by one or more person to the same
set of data
Most data is local and in close proximity to where it is required
APIs and other access methods ADO.NET, JDBC, ODBC and proprietary native APIs CLI-client,
Restful HTTP API
Table 2: Key differences between MySQL and BigchainDB


How BigchainDB works?

How BigchainDB works can be understood by following the life cycle of a transaction. A BigchainDB transaction is a JSON string that conforms to a BigchainDB transaction specification. The system architecture of the BigchainDB network is shown in Figure 1, and it consists of four main components – the BigchainDB node, the BigchainDB server, Tendermint and the MongoDB database. The steps of a BigchainDB transaction are described below.

The four main components
Figure 1: The four main components in the BigchainDB network

Step 1: Sends the transaction to a BigchainDB network: When a user initiates the transaction, the BigchainDB HTTP API is used to send the transaction to a BigchainDB network.

Step 2: Arrival of the transaction at BigchainDB server: Once the transaction is successfully received and validated at the BigchainDB server, it is converted into Base64 and a new JSON string. The BigchainDB server then sends this JSON string to a local Tendermint node.

Step 3: Arrival of the transaction at a Tendermint instance: When the transaction arrives at the Tendermint node, it is processed using the CheckTx API and included in the memory pool. A memory pool consists of transactions that have been validated but not included in any of the blocks yet. When the new block needs to be added to the existing network, the Tendermint node takes care of the Byzantine fault-tolerant property.

Step 4: Writing transactions to MongoDB: Finally, the Tendermint node delivers the transaction to a BigchainDB to check its validity. Once the transaction is committed successfully, it is written to a MongoDB database.

Steps for installing the BigchainDB server
The BigchainDB server, MongoDB and Tendermint, must run in every BigchainDB node. The steps for installing the BigchainDB server, MongoDB and Tendermint on Ubuntu 18.04 Linux OS are described below.

Step 1: Installing the BigchainDB server: The BigchainDB server requires the Python 3.6+ version; so first install the required Python package, as follows:

# Installation of python latest version on Ubuntu 18.04 
$ sudo apt install -y python3-pip libssl-dev

Now, the latest version of the BigchainDB server can be installed using the following command:

# 2.2.1 is the latest version of BigchainDB server:
$ sudo pip3 install bigchaindb==2.2.1

The installed version of BigchainDB can be checked using the command given below:

$ bigchaindb - -version

Step 2: Installing and starting MongoDB: BigchainDB requires version 3.4 or higher for the MongoDB database; so ensure that by using the following command:

$ sudo apt install -y mongodb

#Check the status of database working or not
$ sudo systemctl status mongodb

Step 3: Installing Tendermint: The BigchainDB server works well with Tendermint 0.31.5 (not a higher version number). To install and start Tendermint, use the following commands:

$ sudo apt install -y unzips
$ wget
https://github.com/tendermint/tendermint/releases/download/v0.31.5/tendermint_v0.31.5_linux_amd64.zip

$ unzip tendermint_v0.31.5_linux_amd64.zip
$ rm tendermint_v0.31.5_linux_amd64.zip
$ sudo mv tendermint /usr/local/bin

# Start Tendermint node
$ terdermint init

BigchainDB combines an enterprise-grade distributed database (MongoDB) with a production-ready consensus engine (Tendermint) to provide the key benefits of both distributed databases and blockchain technology.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here