1st HAF Projects Development Report for 2022

in HiveDevs2 years ago

1st-.png

1st update on the development of Plug & Play and Global Notification System (GNS).


There's a proposal up to fund the work I am doing. You can vote for it here:


gns icon.png

Global Notification System

Most of my work was on GNS as I developed some of the core functionality such as account preferences and also updating the documentation.

Pull Request: https://github.com/imwatsi/hive-gns/pull/11
API Docs: https://gns-beta.imwatsi.com/docs

Documentation

A summary of the documentation work I did.

Updated README

https://github.com/imwatsi/hive-gns/blob/main/README.md

The README now contains links to more documentation detailing how accounts can set preferences for each notification type available on GNS. The README also has links to integration and internal HAF Operation IDs docs, as explained below.

Integration

https://github.com/imwatsi/hive-gns/blob/main/docs/integration.md

To add a new notification class:

  • name the module containing its data (for example core contains core notifications and splinterlands contains Splinterlands notifications

  • write SQL functions to handle the operations

  • define the hook, which essentially a JSON file with notification types, their respective HAF Internal Op IDs, the function that handles it (from step 2 above) and the notif_code to use (a 3 char code)

See the core module on GitHub

Internal HAF Op IDs

https://github.com/imwatsi/hive-gns/blob/main/docs/haf_op_ids.md

HAF uses IDs to identify all the available operations on Hive and these have integer codes. For example:

  • 2 transfer_operation

  • 18 custom_json_operation

This document hosts the IDs, with sample payloads found in the HAF database, for reference when defining your GNS hooks.

Account preferences

https://github.com/imwatsi/hive-gns/blob/main/docs/broadcast_ops.md

Account preferences are set by broadcasting custom_json operations. When broadcasting these operations, use gns as the custom_json ID.

  • the main json payload is stored in an array

  • the first element is the op_name

  • the second is the actual payload

Enabling notifications

Notifications are enabled on a module by module basis, by broadcasting a custom_json op. The example below:

  • enables notifications for core HIVE/HBD transfers and sets a minimum of 1 HBD for HBD transfers

  • enables vote notifications for votes over 12345 weight and summarizes every 12 hours

  • enables all splinterlands notifications and sets a minimum of 1 DEC for DEC transfer notifications

id : gns

json :

[
    "prefs",
    {
        "core": {
            "enabled": ["trn", "vot"],
            "trn": {
                "min_hbd": 1
            },
            "vot": {
                "min_weight": 12345,
                "freq": 12,                         # hours
                "summary": true
            }

        },
        "splinterlands": {
            "enabled": "*",
            "trn": {
                "min_dec": 1
            }
        }
    }
]

More documentation will be published soon, to further explain the available preferences for each notification type.

Marking notifications as “read”

You can mark all notifications as “read” or individual notification types under a class. Broadcast a custom_json operation with gns as the id and the following as the JSON payload:

Mark all core notifications as “read”

[
    "read",
    ["core.*"]
]

Mark all notifications as “read”

[
    "read",
    "*"
]

plug.png

Plug & Play

Summary of my work on Plug & Play.

FastAPI updates

  • Multiple workers to handle more traffic, currently set at 50 workers

  • Use FastAPI routers to modularize endpoint structure

Podping upgrade

@brianoflondon and I implemented a limit parameter to another one of Podping’s historical data endpoints on Plug & Play.

Automation scripts

I have begun writing some bash scripts to automate some administrative tasks for Plug & Play.

Restart bash script

One might need to restart the Plug & Play app (and possibly also the PostgreSQL service) to recover from an error or the like. This bash script allows you to do so in one command.

View on GitHub

Reset bash script

There are instances where you might want to reset the Plug & Play app and its data to start a fresh installation with breaking changes. This reset script allows you to delete all Plug & Play data in PostgreSQL and initiate a new run safely, without removing the main HAF database.

View on GitHub


What’s next?

GNS

  • Implement the new HAF operation filtering

  • Upgrade development server to latest HAF software

  • Add more notification types

    • Hive Engine activity

    • More Splinterlands activity

    • Power up

    • Power down

    • Vest withdrawals

    • Delegations received

    • Votes

    • Comments

    • Reblogs

    • Follows

    • Unfollows

    • Mentions

    • … and more

  • Add more documentation

    • HAF internal Op IDs

    • How to design the endpoints for custom integrations

    • How to design the functions for custom integrations

    • FastAPI metadata

Plug & Play

  • Implement the new HAF operation filtering

  • Redesign for simple custom deployment, with Plug based filtering

  • Automation and CI scripts

  • Upgrade production, development and backup servers to latest HAF software


Thanks for reading!

There's a proposal up to fund the work I am doing. You can vote for it here:



I run a Hive witness node:

Sort:  


Congratulations @imwatsi!
You raised your level and are now a Minnow!

Thank u.im menati.nice 2 meet you

Awesome work! Hope you'll get funded soon 👍
I've seen you around for long. Notifications are important for many users. I don't overthink them. But there are billions spoiled by what they are used to with FB, Instagram etc.
!PIZZA !LUV

PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
@d-zero(1/5) tipped @imwatsi (x1)

Please vote for pizza.witness!

Of course you have my support :)