4. Databases This is the fourth and last chapter of a series about web decentralization. As we have seen in the , the blockchain and smart contracts are great to store records for some specific use cases (like financial transactions), but they are not going to replace your whole database. Here we are going to focus on : What are the current candidates and how do they compare each other. Then we will conclude this series and step back on what we have learned. previous chapter distributed and decentralized databases Series articles Introduction File storage Blockchain and smart contracts Databases Introduction For once, let's start with a theorem — the : CAP theorem The CAP theorem states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:- : Every read receives the most recent write or an error- : Every request receives a (non-error) response — without the guarantee that it contains the most recent write- : The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes — Consistency Availability Partition tolerance Source This theorem is not perfect, but it is simple and gives you an idea of the design trade-off in a quick glance. It will help us to classify the different candidates. Also, if you have no idea of what we are talking about, here is a good introduction: _1. A database is an organized collection of information or data. Nowadays there is a large stream of information, and…_cointelegraph.com Decentralized and Distributed Databases, Explained All good? Now let's have a look at these 5 solutions: GUN Fluence Bluzelle BigchainDB Ties.DB 1. GUN https://gun.eco GUN is: A , , , database. real-time decentralized offline first graph : it guarantees , , but only . It makes it particularly interesting for real-time (chat, online game, live sensors visualization on IOT, …), but you should probably avoid using it when consistency is critical, like in banking. Read more . AP availability partition tolerance eventual consistency here . Current adapters include File Storage, Local Storage (in the browser), IPFS and S3. Storage-agnostic Coded in and super easy to use (see ). JavaScript API docs : capable of doing 20M+ API ops/sec. Highly scalable VC-backed and . raised $1.5M in 2018 The roadmap is available . here Note that GUN can be used without any server (except for peers discovery), but the data will only persist in the browser local storage. So if you need data persistence, you should always keep a few nodes running. The Universe is not Strongly Consistent GUN made an interesting trade-off by focusing on real-time and offline capability. If you want to understand why explains well the pros and the cons in a simple and fun way. GUN may not suit for every application, but it definitely worth having a look to it! this presentation 2. Fluence _Developers can use Fluence network to create a trustless query layer over the blockchains, making blockchain data…_fluence.network Fluence network - decentralized data processing that works. Fluence started as a decentralized database network and to become a . recently shifted trust-less query layer over the Ethereum blockchain Fluence creates an independent network with its own decentralized consensus for each query, security model and crypto-economics design. This network is optimized for retrieving and processing data from decentralized sources without sacrificing the security and performance. Databases, query languages and arbitrary algorithms can be created and deployed to the Fluence network and can run completely decentralized on the Fluence virtual machine. With Fluence, you will be able to query data from the blockchain and from cold storage (Ethereum Swarm, IPFS) using SQL, GraphQL or a custom query language. Fluence is CP ( ). The main network should be available soon ( ). see here roadmap In the same vein, you might be interested in , a GraphQL interface to Ethereum (which I'm not going to detail here because it relies on a centralized server). EthQL 3. Bluzelle _Add Bluzelle to your tech stack, the distributed database built on ethereum blockchain technology; built by an open…_bluzelle.com The Decentralized Database for Dapps Bluzelle provides a with a . In a similar way than for , nodes can be rewarded with for hosting data. If you are a consumer, you use the same cryptocurrency to rent data storage in the swarm. Bluzelle is also . NoSQL key-value store decentralized database CRUD API many file storage solutions BLZ tokens open source You can either which communicates with the database through WebSockets or use the . The are quite similar to other NoSQL databases. create your own client existing Node.js client available operations Bluzelle is still in beta and you can try it for free on the TestNet. 4. BigchainDB _With high throughput, low latency, powerful query functionality, decentralized control, immutable data storage and…_www.bigchaindb.com BigchainDB * * The blockchain database. With high throughput, low latency, powerful query functionality, decentralized control, immutable data storage and built-in asset support, BigchainDB is like a database with blockchain characteristics. BigchainDB introduces a new paradigm in databases. It is asset-focused (instead of table or document focused) and works with 2 kinds of transactions: CREATE and TRANSFER: Key concepts of BigchainDB BigchainDB by the which provides a TestNet and maintains the open source code base. A is available in different languages, as well as a . is now managed IPDB foundation bunch of drivers GraphQL interface It is now available in . Have a look at if you want to go further. v2.0.0b9 this introduction 5. Ties.DB _The world's first decentralized public smart database_tiesdb.com First Decentralized Public Database for dApps A public, distributed and decentralized database with one common thread: trust. Enforced by integrated fault tolerance, incentive schemes and smart contracts. Like with Bluzelle, Ties.DB incentives nodes to process queries and host data by paying them in . For now, the network is integrated with Ethereum but they are planning to integrate with other blockchains in the future. Ties.DB is . You can give a try to the alpha version . TIE tokens AP here You can either use the (with some functions like ) or fetch your data using (a SQL-like query language). Node.js client putField TiQL Bonus point for offering a (something similar to phpMyAdmin for MySQL): user-friendly GUI Ties.DB explorer Conclusion We have had a look at the 3 most important bricks of the decentralized web: How to store files How to get a consensus How to store relational data So what's the current state of these technologies? Should you start your new project in a decentralized way? Well in my opinion… it depends on your project. We are still at a very early stage of web decentralization, and it is a totally new paradigm compared to the current web. If you are working on something experimental, then go for it and choose any of those technologies. You will learn A LOT. Even though some tools are still unstable for the moment, it should get better with time and you will be part of it! If your project does not aim to generate incomes but you need to store a large amount of data, I would recommend decentralizing the storage layer on IPFS. You will save a lot of money and still have something extremely scalable. You could ask your community to host some IPFS nodes. In addition, if your project dies for some reason, users could still have access to their data on IPFS. If your project needs real-time data but does not require strong consistency (like for a chat), you should consider using GUN. It is really nice to use, looks quite stable and is already being used by large dApps. Concerning the blockchain, . Most of the time the reason was not "Is blockchain a good fit for that purpose?" but "Does it worth affording all the complexity the blockchain brings for that purpose?". I strongly think that blockchain will keep evolving and getting better in the next few years. However, it was probably a few years too early to start using it for every purpose. There are still some really good reasons to start a project using the blockchain, it's up to everyone to balance. But if you are willing to use blockchain just traceability purpose, something like BigchainDB can probably provide what you need in a simpler way. 2018 has seen lots of really interesting projects die Also, I would recommend you to keep an eye on a few projects which are developing an abstraction layer making it much easier for developers to integrate with decentralized technologies. They are still young but if they can deliver what they promise, building a dApp will be as easy as developing a normal app! Here are my 3 favorites: : The decentralized cloud provider. Their roadmap includes storage, compute layer, CDN, API, queues, well everything you need. DADI : Like for DADI but limited to identity and storage. Blockstack : While building their on top of IPFS, they faced many issues like identity management, pinning files on IPFS, notifications, how to get it working on mobile, … All those things are available in their . They also provide a . Textile Photos dApp go-textile framework React Native SDK That's all for me, thanks for reading! Feel free to share your thoughts and experiments about web decentralization in the comments.