The BigchainDB is a scalable distributed database which can be used for the blockchain technology. In a normal case, blockchain itself is the database. As in the case of bitcoin and many blockchain applications the blocks is providing the storage facility too. There are no additional databases. But the BigchainDB provides an alternative to this method .The BigchainDB will work as a distributed database with all characteristics of a blockchain





The BigchainDB was first introduced as a distributed database and later the characteristic of blockchain technology has added to it. Now BigchainDB has the features of both traditional blockchain (like bitcoin) and the distributed database and it supports both private and public networks. BigchainDB is a NoSQL(Non-SQL) database which provides a storage mechanism and data retrieval models other than the tabular relations used in relational databases.





The commonly used NoSQL types are Key-value stores, Document database, Wide column stores and Graph stores. Each of these NoSQL databases adopts different methods of data storage. The developer can select any of the above models according to the requirement and use case.





Why BigchainDB?

Normal blockchain networks like bitcoin suffer from several problems like low throughput, high latency, low storage capacity etc. In a bitcoin network, the latency before a single confirmed write is about 10 minutes and throughput is only a few transactions per second. The storage capacity is also not promising as it is still pegging at a few dozen GB. But in BigchainDB the throughput is about 1million writes per second and latency is also significantly lower. The storage capacity of BigchainDB is that of a distributed database. Which means the capacity will increase as the number of nodes increases.





The BigchainDB has the following features.

- Decentralized control:-No central server for managing the database

- Immutability:-Once a change is made to the database it is immutable.

- Creation & Movement of Digital assets:- Digital assets can be created or manage the BigchainDB





BigchainDB compared to Normal Blockchain and Distributed Database



Traditional Blockchain Distributed Database BigchainDB Throughput Low (few transaction per second) High (increase with nodes) High (increase with nodes) Latency High (10 min) Low Low Storage capacity Low High (increase with nodes) High (increase with nodes) Query capability No Yes Yes Rich permissioning No Yes Yes Decentralized Control Yes No Yes Immutability Yes No Yes Creation & Movement of Digital assets Yes No Yes Event Chain Structure Merkle tree - Hash Chain

Models in BigchainDB

Three models namely Transaction model, Block model, and Vote model are the backbone of BigchainDB. These models give it the advantages of Blockchain as well as the normal database.

Transaction Models in BigchainDB The basic component of BigchainDB is transactions. Every data stored in it will the details of the individual transaction. Two types of transaction models are used in BigchainDB 1) Creation Transaction 2) Transfer Transaction

The “Creation Transaction” is used to initialize the details of an asset in the blockchain and the “Transfer Transaction” is used to transfer ownership of the asset.

A transaction in a JSON document will have the following structure {

"id": "<hash of transaction , excluding signatures >",

"version": "<version number of the transaction model >",

"transaction": {

"fulfillments": ["<list of fulfillments >"],

"conditions": ["<list of conditions >"],

"operation": "<string >",

"timestamp": "<timestamp from client >",

"data": {

"hash": "<hash of payload >",

"payload": "<any JSON document >"

}

}

}

Id: Is the primary key. It will be the hash value of that particular transaction, Version: It is the version number of that transaction model, Fulfillments: Each fulfillment is a pointer to the unspent assets. It will point to the ownership of an asset, Conditions: List of conditions that should be fulfilled by the transfer transactions, Operation: String representation of the operation to be performed, Timestamp: Transaction creation time in UTC. Provided by the user, Hash: It is the hash value of the serialized payload, Payload: It can be any JSON document. For a transfer transaction, it will be empty. All the transactions in the BigchainDB will be stored in the above-mentioned structure only.

Block Models in BigchainDB The blocks are also represented as JSON documents in the following structure, {

"id": "<hash of block >",

"block": {

"timestamp": "<block -creation timestamp >",

"transactions": ["<list of transactions >"],

"node_pubkey": "<public key of the node creating the block >",

"voters": ["<list of federation nodes public keys >"]

},

"signature": "<signature of block >",

"votes": ["<list of votes >"]

}

Id: The primary key. It is the hash of the serialized block, Timestamp: It is the time of creation of a block. It is given by the created the node, Transactions: The list of transactions included in the block, Node-pub key: The public key of the node, that created the block, Voters: It is the list of public key of federation nodes existed in the system when the node is created, Signature: Signature of the block by the node who created the block, It is generated by serializing the block data and using the private key, Votes: list of votes given by the voters.



A vote has the following structure: {

"node_pubkey": "<the public key of the voting node >",

"vote": {

"voting_for_block": "<id of the block the node is voting for >",

"previous_block": "<id of the block previous to this one >",

"is_block_valid": "<true|false >",

"invalid_reason": "<None|DOUBLE_SPEND|TRANSACTIONS_HASH_MISMATCH|

NODES_PUBKEYS_MISMATCH",

"timestamp": "<timestamp of the voting action >"

},

"signature": "<signature of vote >"

}

Node_pubkey: It is the public key of the voting node. Voting_for_block: Id of the block for which a node is voting Previous_block: Id of the previous block Is_block_valid: Vote for the block it can be true or false. I.e. positive or negative vote Invalid_reason: Reason for invalidating or voting ’false’. Timestamp: Time at which voting action takes place. Signature: Signature for the vote.

Among many other new generations, blockchain related technologies BigchainDB is a unique one as it changes the very data storage mechanism of the blockchain. From the initial assessment, it is a promising technology, especially for handling the huge amount of data. It has the potential to leverage the blockchain technology in the domains like Big data analysis AI etc.