Hi Everyone 鉂椻潡
Especially HiveFest 2024 visitors who are interested in simplified and efficient application development for Hive Platform.
During many talks with you we promised to provide you with some tips how to start designing your application architecture to match all the tools currently available on the Hive Development stack.
In our vision of the current stack, at an application high level design, we have a few cases which determine used technologies, tools and required resources. Such use of the cases is ideally matching a:
I V like a Initiate a Venture ( a little word game 馃榾 ) to perform a blockchain activity by pushing new operations to it.
If your application doesn't really care about the past and only wants to use a Hive platform as a secure transport layer, you can easily create the app just by using a BeeKeeper and Wax libraries to prepare, sign and broadcast transactions.
Below we are also presenting in greater detail an example application being able to
push own operations to the blockchain.
Event consuming 馃榾 In Hive Platform can be also a lightweight and simple process.
The idea behind it is to make the process of catching blockchain data natural and easy to understand for regular programmers. To do it, we prepared another frontend library: WorkerBee, which allows you to write your own bots. The third part of this article will show you an example that is very easy to understand without any specific knowledge of blockchain.
Local HAF-node will allow the direct use of a SQL database holding relational representation of blockchain operations, divided into blocks and transactions.This solution gives you best ability for massive data processing (since you have direct access to them in local database), but it also brings the biggest resource needs - full deployment can even need 4TB of disk space.
Beside HAF-node, you will also need your backend application - SQL based - which will be continuously processing the operations incoming into HAF database and collecting data specific to your application schema.
During this process the whole interaction to blockchain is hidden by HAF - your task is just to program SQL data processing.
We will describe setup steps soon in a separate article (including example deployment of small HAF lab and some simple HAF application). The impatient ones please go to HAF deployment
Execution of operations on blockchain requires specific steps and a little knowledge of Hive blockchain technical side.
The first thing that you need to know is a set of operations supported by the Hive platform. You can find them in the Hive repository
It is also worth mentioning that you are not limited to the set of operations already included in the Hive Protocol. The Hive Protocol allows you to push operations being really unknown for blockchain itself, but being recognized by your application. To use this magic feature, you just should use a custom_json operation.
Finally, to send operations to the blockchain, they must be wrapped in a transaction and then signed using authority used to perform the operation. Transaction is an envelope holding multiple operations and account authority data, needed by blockchain processing algorithms.
To materialize this workload, you don't even need ANY backend services nor data storage: just the frontend part (using Beekeeper & Wax Typescript features) of your application could be sufficient to perform such activity. Wax hides all blockchain complexity and makes transaction creation process easy.
Beside web browsers, both libraries can be also used as a part of NodeJS deployments, so without touching other technologies than JavaScript, you can make fully functional applications, holding your own data and performing some server-side data processing.
Here is a link to TS example preparing some transaction: pushing a comment reply
To make this process easy to understand for frontend programmers, we decided to use some well known libraries: events and RxJS to build observable model on. The WorkerBee library hides some blockchain specifics (i.e. a need to call some APIs) and allows you to focus only on processing events when:
Here is an example application watching some Hive account and sending notifications to the Telegram bot (created separately). It is worth mentioning that the amount of code specific to Hive (actually calls to the WorkerBee library) is just a small part of this program: the rest is specific to Telegram protocol handling.
Event notifier talking to telegram
Thanks for reading and we are waiting for your feedback.