BigchainDB: Blockchain and Data Storage

Share this article

BigchainDB: Blockchain and Data Storage

Key Takeaways

  • BigchainDB, initially built as a technology to replace the Bitcoin blockchain in the Ascribe digital artwork tracking project, has evolved into a storage layer for the Ocean protocol. It now encourages users to utilize their public network instead of deploying individual instances, a shift from traditional distributed database practice.
  • BigchainDB offers a unique combination of blockchain and traditional database features. It provides high throughput, low latency, and querying capabilities, typically unavailable in other decentralized storage solutions. Moreover, it ensures data privacy through cryptographic techniques and supports private blockchain networks for further data security.
  • The emergence of BigchainDB and other blockchain-based databases, such as FlureeDB and OrbitDB, completes the puzzle for a complete decentralized application stack. With these technologies, a different way of developing, deploying, and maintaining applications is possible, potentially leading to a decentralized future in data storage.

Since I wrote this post, a lot has changed for BigchainDB and in the blockchain space broadly, so it seemed high time for a revisit and refresh of what effect blockchain can have on one of the more fundamental parts of the traditional computing space: data storage.

Originally built as a technology to replace the Bitcoin blockchain in the Ascribe digital artwork tracking project, BigchainDB expanded into a component of the abandoned IPDB and now as a storage layer for the bold Ocean protocol.

This change in use caused changes to the underpinnings and implementation of BigchainDB, as did the closure of RethinkDB, forcing the team to switch the storage engine to the stalwart MongoDB. The blockchain layer on top of the database that provides the transactional support that helps guarantee a database change has taken place and adds additional control and security remains, but has gained maturity, with BigchainDB set to hit 2.0 in 2018.

All these changes now mean that BigchainDB encourages you to use their public network instead of deploying your instances. This approach is somewhat counter to traditional distributed database practice, but is more in-fitting with the evolution of Blockchain-based projects over the past few years, helps BigchainDB monetize their platform (with an ICO or SaaS model) and is an interesting change. Time will tell if customers are comfortable with storing data in a public network, but with access tokens ensuring security and privacy, it’s conceptually not too dissimilar from using a cloud-hosted database.

If you want, you can still install your own BigchainDB instances, but I feel the company will increasingly encourage you not to.

Whichever option you take, you can then use the official Python, JavaScript or community drivers. For example, with JavaScript, install the package with npm install bigchaindb-driver, create a connection and write and read assets to the database using appropriate keys for the writer and reader.

You can read full documentation for the driver here and the database here, but the example below creates an article asset for author and then assigns it to assignee:

const driver = require('bigchaindb-driver')
const author = new driver.Ed25519Keypair()
const assignee = new driver.Ed25519Keypair()

console.log('Author: ', author.publicKey)
console.log('Assignee: ', assignee.publicKey)

const assetdata = {
    'article': {
        'title': 'Blockchain DBs',
        'body': 'Article body',
    }
}

const txCreateAuthorSimple = driver.Transaction.makeCreateTransaction(
    assetdata,
    [driver.Transaction.makeOutput(
        driver.Transaction.makeEd25519Condition(author.publicKey))
    ],
    author.publicKey
)

const txCreateAuthorSimpleSigned = driver.Transaction.signTransaction(txCreateAuthorSimple, author.privateKey)

let conn = new driver.Connection('https://test.bigchaindb.com/api/v1/', {
    app_id: '<APP_ID>',
    app_key: '<APP_KEY>'
})

conn.postTransactionCommit(txCreateAuthorSimpleSigned)
    .then(retrievedTx => console.log('Transaction', retrievedTx.id, 'successfully posted.'))

    .then(() => {
        const txTransferAssignee = driver.Transaction.makeTransferTransaction(
            [{tx: txCreateAuthorSimpleSigned, output_index: 0}],
            [driver.Transaction.makeOutput(driver.Transaction.makeEd25519Condition(assignee.publicKey))],
            {price: '100 dollars'}
        )

        let txTransferAssigneeSigned = driver.Transaction.signTransaction(txTransferAssignee, author.privateKey)
        console.log('Posting signed transaction: ', txTransferAssigneeSigned)

        return conn.postTransactionCommit(txTransferAssigneeSigned)
    })
    .then(res => {
        console.log('Response from BDB server:', res)
        return res.id
    })
    .then(tx => {
        console.log('Is Assignee the owner?', tx['outputs'][0]['public_keys'][0] == assignee.publicKey)
        console.log('Was Author the previous owner?', tx['inputs'][0]['owners_before'][0] == author.publicKey)
    })
    // Search for asset based on the serial number of the bicycle
    .then(() => conn.searchAssets('Blockchain DBs'))
    .then(assets => console.log('Found assets with title:', assets))

Other Alternatives

BigchainDB is no longer the only blockchain-based database in town, depending on your definition, and what you want to accomplish.

FlureeDB wraps a graph-style database with a blockchain layer, which — when you consider the nature of Blockchain — makes some sense. Thanks to the Graph underpinnings, it integrates well with GraphQL and React. It’s still in active development, and follows familiar funding models for databases, with a limited community version, and extra capacity, security and support for premium users. FlureeDB’s involvement with Blockchain technology seems to be using tokens as a replacement for money and some form of consensus mechanism. The project is not open source, so it’s hard to tell what’s under the hood.

From memory, OrbitDB has existed for about as long as BigchainDB, but designed for simpler application needs. While it uses IPFS for storage (which some might claim as a database of sorts), it doesn’t claim to be a “blockchain database”, but rather a choice for decentralized apps.

TiesDB makes a lot of bold claims on its site, but with little detail about how it accomplishes them, and with a sparse repository and sparser documentation on how to run the database, it’s hard to confirm if it delivers. There’s a handful of whitepapers in the repository readme that you can sift through, but they still mostly cover theory rather than practice. Intriguingly, it also allows you to delete data, which, while a fundamental part of traditional databases, somewhat contradicts blockchain ideals. There’s no wrong or right in this decision; some developers have to consider compromises to push blockchain technologies into the mainstream.

Swarm is an Ethereum component that’s the default storage mechanism for distributed apps (Dapps). It doesn’t offer such a seamless way to get started, but if you’re already investigating Ethereum for its other components, then read the documentation for more details.

Filecoin does something different. It offers a mechanism for tracking transactions between blocks of spare storage around data centers and the Internet. It allows you to use traditional storage, but via a blockchain layer that lets users bid for space you offer and tracks their usage of it.

Both of these technologies are described in more detail in this post.

Part of a Decentralized Future

Ignoring its Blockchain heritage for a moment, BigchainDB supplies functionality missing from current NoSQL and distributed databases. That fact alone may be a reason to try it and may provide a valid business/use case.

For the blockchain aficionados among you, BigchainDB and other alternatives also complete the puzzle for a complete decentralized application stack — with Ethereum for applications, IPFS as a file system and BigchainDB for data storage. The pieces are in place for a different way of developing, deploying and maintaining applications, leading to a fascinating future that I would love to hear your opinions on.

Frequently Asked Questions (FAQs) about BigchainDB and Blockchain Data Storage

What is the main difference between BigchainDB and traditional blockchain storage?

BigchainDB is a unique blockchain database that combines the benefits of blockchain technology with the features of traditional databases. Unlike traditional blockchain storage, BigchainDB offers high throughput, low latency, querying, and other functionalities of a traditional database. It is designed to merge the best of both worlds, providing the immutability, decentralization, and consensus of blockchain with the speed and capacity of a traditional database.

How does BigchainDB ensure data privacy?

BigchainDB ensures data privacy by using cryptographic techniques. Each transaction is signed with a private key, ensuring that only the owner of the data can modify it. Additionally, BigchainDB supports private blockchain networks where access can be restricted to specific participants, further enhancing data privacy.

What are the potential applications of BigchainDB?

BigchainDB can be used in a wide range of applications. It can be used for supply chain management, intellectual property protection, identity verification, and more. Its ability to handle large volumes of data and provide real-time access makes it suitable for industries that require secure, scalable, and efficient data management.

How does BigchainDB compare to other decentralized data storage offerings?

BigchainDB stands out from other decentralized data storage offerings due to its unique combination of blockchain and traditional database features. It offers high throughput, low latency, and querying capabilities, which are not typically found in other decentralized storage solutions. Moreover, it provides the security and immutability of blockchain technology.

How does BigchainDB contribute to the future of data storage?

BigchainDB represents a significant step forward in the evolution of data storage. By combining the benefits of blockchain technology with the capabilities of traditional databases, it offers a solution that is secure, scalable, and efficient. This makes it a promising tool for managing the increasing volumes of data generated in today’s digital world.

Is BigchainDB suitable for small businesses?

Yes, BigchainDB is suitable for businesses of all sizes. Its scalability and efficiency make it a viable option for small businesses that need to manage and secure their data. Moreover, its decentralized nature can help small businesses reduce their reliance on centralized data storage providers.

What are the technical requirements for implementing BigchainDB?

Implementing BigchainDB requires a server with a minimum of 4GB RAM and 50GB of disk space. It also requires a modern operating system like Ubuntu 16.04 or higher, and Docker for containerization.

How does BigchainDB handle data integrity?

BigchainDB ensures data integrity through its use of blockchain technology. Each transaction is recorded on the blockchain, creating an immutable record that cannot be altered. This ensures that the data remains consistent and accurate over time.

Can BigchainDB be integrated with other systems?

Yes, BigchainDB can be integrated with other systems. It provides a RESTful API that allows developers to interact with the database, making it possible to integrate BigchainDB with existing software and systems.

What is the learning curve for BigchainDB?

While BigchainDB combines features of traditional databases and blockchain, it is designed to be user-friendly. However, a basic understanding of blockchain technology and databases would be beneficial. There are also numerous resources and tutorials available online to help users get started with BigchainDB.

Chris WardChris Ward
View Author

Developer Relations, Technical Writing and Editing, (Board) Game Design, Education, Explanation and always more to come. English/Australian living in Berlin, Herzlich Willkommen!

BigChainDBblockchaindata storagedatabaseethereumethereum-hubIPFSlearn-ethereumSwarm
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week