👀Overview
In which ways can HollowDB be used?
Last updated
In which ways can HollowDB be used?
Last updated
HollowDB can be used in many ways, with or without a backend and with different types of wallets. Although the interface of HollowDB is very simple, there are several things to consider when you are building an application with HollowDB:
Side-effects of lazy evaluation that is used in SmartWeave.
Value size & usage of Bundlr.
Modes of operation, i.e. proofs & whitelisting.
SmartWeave uses lazy-evaluation to move the burden of contract execution from network nodes to smart contract users. Currently, SmartWeave supports JavaScript, using the client's unmodified execution engine.
What this means is that, when a new client wants to make a transaction on a contract, they must download all preceding transactions and evaluate them locally. By doing that, they effectively reach the present state of the contract, upon which they execute their transaction.
The immediate side-effect of this is that if a contract has many interactions, it will take a longer time to lazy-evaluate it. Since HollowDB is a key-value database operated by a SmartWeave smart contract, the more keys & interaction a contract has, the longer it will take for clients to lazy-evaluate it.
Depending on your key-count and the data-size, you might prefer different architectures for your application. Let’s take a look at these scenarios:
There are various examples to demonstrate the basic operations of the HollowDB. Check out example.js
and exampleBundlr.js
and configure the variables. Then, put your an Arweave wallet (JWK) inside examples/config/wallet.js
.
To run the examples:
We also have a simple NextJS application to demonstrate wallet-connections and usage of HollowDB within the browser.
For bigger examples with frontend, check out:
If you haven't seen already, check the Quick Start section to see the most basic example usage of HollowDB:
Small value per key (< 2KB)
Large value per key (>= 2KB)
Few keys per user
Client-side only is probably enough, unless this is a very active app with many users.
You might use client-side only, but it would require the users to have a funded Bundlr account.
Many keys per user
Client-side only may be enough, but consider a backend if there are many users. Or, use several contracts to group users.
You should use a backend with your own wallet to make the requests & upload to Bundlr when needed.