Posts

Hive Application Framework Is a Great Start, But Still Expensive

avatar of @beggars
25
@beggars
·
·
0 views
·
3 min read

Since abandoning the media tokens idea from the early Steem days, @blocktrades has been working on a new future vision for building decentralised applications on the Hive blockchain dubbed Hive Application Framework (HAF).

On the surface, it's a fantastic idea. To summarise what HAF does, it's a Hived node with some microservices to watch the blockchain and then store the results in a PostgreSQL database. It watches the Hive blockchain and stores the data in database tables, complete with functionality for dealing with the complexities of forks. That's how most Hive dApps operate, from Splinterlands to Hive Engine.

In their Developers Introduction to HAF post, @blocktrades goes through some of the technicals of how it all works, but things get interesting when we get to the recommended server requirements part for a full node.

At Hive's current block height of 60M+ blocks, a general purpose HAF database capable of running all HAF apps takes up about 2.7TB of storage before accounting for storage consumed by app-specific data. So, at a bare minimum, you will want at least 4TB of storage for a general purpose HAF server.

In 2022, 4 terabytes of storage might not sound like a lot. But, for cloud providers, storage is still ridiculously expensive. To run an Amazon RDS PostgreSQL instance db.m1.small, which offers a meagre one vCPU and 1.7 GB of memory, 4 TB of storage using General Purpose SSD (gp2) comes in at USD 1,266.28 per month. Remember that RDS handles many scaling concerns for you, so you're paying for a managed service where you don't have to install and configure PostgreSQL.

If you opt for an EC2 instance using t4g.large, which has two vCPUs and 8 GB of memory with 4 TB of storage, you're looking at a slightly better USD 530.50. You will have to install and manage the database instance yourself, as well as any scaling considerations.

Now, I want to point out that in that announcement post, they also say there will be smaller storage requirement HAF instances supported soon. Given its age of it, it's possible smaller storage might be supported now.

Note that it will soon be possible to setup app-specific HAF servers that have much smaller storage requirements, but when first learning about HAF you will need a general purpose HAF server to experiment with the example apps.

So, this excessive storage requirement is for those who want to get started with HAF and have experience setting up servers and configuring databases. For some, the upfront cost will deter some from trying out HAF.

Blocktrades did reply to someone else in the comments and mentioned that filtering would be available in a couple of weeks (this was ten months ago). I looked through the HAF codebase and couldn't see the ability to bring down the size, nor what the size requirements would be for a more specific HAF instance (presumably only watching for specific transactions instead of everything).

I can see how only saving transactions relevant to your dApp would bring down the cost; I do something similar with my Hive Stream library, allowing you only to store relevant blockchain information based on specific transfers or custom JSON operations.

Even if filtering does bring down the cost, it highlights the need for something far bigger and accessible beside the price.

HAF as a service

Not everyone can afford to run HAF servers (even if they get the requirements down). Not everyone can set up servers to do so, which raises a bigger opportunity; Hive Application Framework As a Service (HAFAAS).

If you look at what is already available, HAFAAS exists (sort of). @arcange runs a service called HiveSQL, which is funded by Hive proposals (go and support the latest proposal if you haven't already). It's a publicly accessible read-only MS-SQL Server database that allows you to query the Hive blockchain (without running your server).

Some considerations would need to be made to create an open HAF database platform that supports reads and writes (as HAF apps will use custom tables and Hive data). But imagine a Firebase-like platform for building Hive applications with provisioned databases and a nice UI to manage it all.

Posted Using LeoFinance Beta