A Distributed Server-less Blockchain Based Cache System
Caching is a crucial feature for web3 applications in the matter of scaling. Nowadays, blockchain-based apps struggle to give their users a web2 UX due to decentralization, like querying all of the distributed ledger data (or large size of it), implement complex logic, computations, etc.
If you are going to build a fully decentralized app, completely on-chain, you need to make a choice between decentralization and user experience. It’s a hard choice! Especially if your Dapp has the “ethics” of being user-owned, like the example that will be discussed shortly.
fact: if your platform takes more than ~13–15 secs to display data on the client-side, it will lose users for better competitors that scale.
Implementation:
In this section, we will take a look over decent.land, which is an Arweave based app.
First of all, what is Arweave?
Arweave is a new type of storage that backs data with sustainable and perpetual endowments, allowing users and developers to truly store data, theoretically forever. If you would like to learn more about how Arweave works, please check the Yellow Paper.
Okay, how about DecentLand?
DecentLand is a decentralized social network protocol built on Arweave’s Permaweb (aka decentralized-Reddit). Unlike other existing social protocols, decent.land is a composed data protocol, as same as DeFi is the lego of finance. the Tribus represents the “front-page” of an Arweave DAO (aka PSC).
DAO members, after meeting the Tribus requirements, will be able to join it and participate in the social experiment (post). And unlike Reddit communities (subreddits), each Tribus is completely owned and moderated by the DAO members, the token holders.
Load-Speed Comparison:
First, let’s check how long could the`public-square` Tribus takes to load all of the tribus posts:
A- Decoding Tags:
DecentLand workflow logic requires tags decoding in order to retrieve a post’s metadata. Treated data: an array of 83 posts TXs.
as you see, it took up 240 secs to decode 83 transactions tags only! We still need to decode each transaction’s data.
B- Decoding TXs data:
That’s also another 2 minutes for data decoding, so around 370 sec in total, insane! There is no user, that can wait 6 minutes to explore a Tribus feed…
But if you visit the public-square release where this caching system is implemented, you will clearly notice that it won’t take more than 5 secs to fetch the Tribus data from the Permaweb and display it!
Conclusion
Any Dapp, on any chain, can use a similar caching design to scale. With the tagging standards of Arweave protocol, custom DB-like tables can be permanently stored, and queried w/ seconds! This simple design brings web2 UX for web3 apps, the key to success for any platform.
FIN: custom protocols can be built with ease over Arweave. Therefore, the Arweave network is the L0 for L1s and L2s.
Links:
- check the code: decentland/cache
- Arweave-js