The blockchain landscape has seen tremendous growth due to the emergence of decentralized applications or DApps. These are applications built on top of Layer 1 blockchains like Ethereum, that execute from programmed code called smart contracts. They perform conditions that process transactions on the network, with finality determined by the underlying blockchain. This introduces the idea of programmable finance that runs over a trustless decentralized network, which doesn’t require a third party (e.g. banks).
Despite the success DApps have had on Ethereum and other blockchains (e.g. BSC, Polygon, Solana), there are limitations to their performance. The most critical issue has to do with speed. Reading data from the blockchain is much slower than traditional databases. Since the blockchain was meant to be transparent, confidential data must also be stored off-chain on another database.
There is a better solution for the next generation of applications like DApps that is being pioneered by Fauna. Founded by a team of former Twitter engineers, Fauna has created a serverless data API using GraphQL by combining document model features with relational database capabilities. This novel flexibility offers unique performance advantages for distributed database environments like those that integrate with blockchains. The result is better performance with reliability and scalability.
Performance suffers specifically when it comes to querying data on-chain. A blockchain like Ethereum does not have its own native indexing system, so DApp developers will have to find 3rd party index accelerators (i.e. TheGraph) or off-chain databases to improve performance. This simplifies the task for integrating DApps that have the features of database management systems (e.g. indexing) for the blockchain.
Serverless means the database doesn’t require server administration as a dedicated database management system. It runs under a managed system on the cloud that can scale up or down, depending on the user’s consumption. This also frees up tasks that would require a database administrator. DApp developers do not handle the core tasks of their database. Fauna is a database platform service that handles the backend operations so that developers can focus more on the application.
The Fauna database architecture highlights solid features that take performance to another level. It uses flexible data modeling for indexing various types of documents. It follows distributed ACID properties for transactions to maintain data consistency. Security can be role based to allow for delegation of databases for specific requirements. Most operations also follow the data API approach so interfacing with your database from your application is simple.
Solution For DApps
One of the key features of Fauna is limitless scaling provisions for off-chain data storage. The system dynamically grows with the data requirement needs. In traditional systems, there is maintenance involved in handling storage capacity as the data grows. With Fauna, there is little to no need to manage the database. This offers a convenient way for developers to build DApps faster.
For lower latency, customers of Fauna use off-chain index accelerators like The Graph to improve access to on-chain data. With GraphQL, advanced queries and data manipulation can be handled with minimal network and memory use. It results in faster queries due to the indexing. This provides better performance for DApps even under heavy workloads.
Fauna’s databases are being used in (e.g. Ethereum) and (e.g. rollups) solutions with sidechains (e.g. Polygon Network). The architecture allows DApps to work with off-chain and on-chain data much better when compared to other database systems. DApps can query a Polygon sidechain using GraphQL for faster read access.
Real World Use Cases
There are several use cases that bring Fauna to the forefront of blockchain-based applications. It is finding real world use by companies that integrate a diverse set of tools to deliver solutions to innovative products. They are in a wide range of industries from fashion to healthcare. We will look at two companies that provide an interesting look into how Fauna integrates with the blockchain.
DigitalAX is a company that has developed what it calls a decentralized protocol for unlocked interoperable economies involving fashion, gaming, modding, NFTs, DeFi and DAOs. They are building a platform that brings together a blockchain ecosystem on the metaverse. These are virtual worlds that use digital assets which are verified on a blockchain (i.e. Ethereum). DigitalAX implements Fauna along with Amazon AWS Lambda and the claudia.js framework. Their DApp uses both off-chain and on-chain data that relies on fast queries and optimal performance provided by Fauna.
In the healthcare industry, Acoer is the developer of blockchain-based applications that offer data security and privacy protection. Those are important requirements due to compliance with healthcare laws. What Acoer provides is an interoperable, out-of-the box RESTful API-based software. The applications generate plenty of data that must be stored across the network and verified by a blockchain. A highly scalable database with low latency is required. This integrates Fauna’s database to provide the performance needed while ensuring data security and privacy.
There are plenty of benefits to DApps using a serverless and data API platform like Fauna. The business requirements are more data driven, so they require database servers that can store oceans of data. Fauna is the resilient backend that can pull up large sets of data that can scale when the need arises. This can help to scale any application from a few hundred to millions of users. This applies to DApps since they will have to store off-chain data that can be difficult to manage over time. A platform like Fauna helps to manage the complexities developers face with backend services.
A big data operation is useless if the performance is slow. Fauna optimizes performance with global distribution to make queries faster anywhere in the world. This increases the overall efficiency of a system by reducing the latency when a request is made to the database. Since blockchains do not have a native indexing feature of their own, DApps can use indexing protocols like The Graph to improve performance. By using GraphQL, DApp developers can use the same language between The Graph and Fauna to interoperate easily between on-chain and off-chain data.
For blockchain-based solutions, the use of off-chain data with on-chain data is going to be an important consideration. DApps cannot store sensitive data on the blockchain, therefore they will need an off-chain storage that must be able to work with on-chain data. Fauna can handle the complexity of these systems through API integration. It comes complete with indexing and scaling features to ensure reliable system operation.
Finally, the greatest overall benefits are minimizing administration and lowering operational costs. There is no more need to handle administrative tasks like sharding, provisioning, clustering, replication or upgrading. The API approach is all that is needed to run the database with DApps. This is an ideal solution for tech startups that do not have the resources due to budget constraints. It is also a better solution for cloud native companies that leverage most, if not all their services over a network. More focus can be put into building DApps and less on managing databases.
Originally published at https://www.datadriveninvestor.com on January 13, 2022.
Fauna’s Off-Chain Data Storage For DApps | Data Driven Investor was originally published in DataDrivenInvestor on Medium, where people are continuing the conversation by highlighting and responding to this story.