PEP-26: PoktBot - A new node monitoring tool

Attributes

  • Author(s): Luis F Monge, Iván de Paz

  • Recipient(s): Luis F Monge, Iván de Paz

  • Category: Reimbursement

  • Fulfills: RFP-8

  • Related Installments: None

  • Asking Amount: 30k POKTs. We will be submitting incremental PEPs for the next milestones.

Summary

We would like to propose PoktBot for a funding proposal. PoktBot is a Telegram bot that allows node runners to have a simple tool to monitor their nodes and to ease tracking and managing their node rewards.

Abstract

PoktBot aims to be an easy and intuitive tool for node runners to track the rewards and status of their nodes and maximize their efficiency through constant monitoring for errors and malfunctions.

To this end, a Telegram bot has been developed from scratch, which from its initial stages will have the necessary capabilities to monitor and manage nodes. Taking advantage of Telegram interaction and notification features, every node runner and investor can have instant notifications of node issues, interactive rewards plots and management in their phones at no cost, which could potentially lead to minimize losses and increase investment benefits.
poktbot

Background and motivation

Iván and Luis, started with node management at the end of 2021, quickly realizing that they needed an agile management tool that would allow them to monitor their nodes while keeping investors, who had invested in their nodes, informed.

After the initial development of a private tool, they realized that this need was common to all node runners and decided to make a tool that would ease the work of the node runners and keep investors informed, while facilitating the accounting management of the nodes.

Needs Being Met

To develop a free and open source tool that allows investors and node runners to have useful node & rewards information in real time and, at the same time, maximize their rewards by helping to react quickly to errors through constant tracking and notifications, which can be displayed in their phones.

Objective Key Results

  • Easy bot installation and maintenance with Docker.
  • Constant errors and transaction monitoring.
  • Notification to node runners of errors relevant to node operation.
  • Bot users management.
  • Server management on which the node is hosted. In release 3.

Deliverable(s)

Release 1 (currently)

  • Monitoring validator nodes
    • Node errors monitoring and notification.
      certificate_expiration_min
    • Staking monitoring and notification.
      begin_unstake_min
  • Provides useful stats about node rewards and performance.
    • Daily rewards.
    • Monthly rewards.
    • Graph of rewards evolution.
      rewards
  • Multi-node and multi-user approach
    • Average of stats with all configured nodes.
    • Robust RBAC system with two user levels:
      • Investor, only allowed viewing statistics of validators.
      • Admin, same than Investor but also able to add/remove admins, investors and nodes.
  • Creation of economic reports (csv and xlsx) to follow node economics or tax filing.
  • Fully configurable behavior. Every aspect of the bot is configurable with a configuration file, and some options through the bot interface itself.

Release 2 (2Q)

  • Free public bot for node runners who do not want to install their own bot.
  • Deploy our own nodes for local queries.
  • Change in the data structure to allow users to add the wallets they want to monitor and link it to their Telegram ID.

Release 3 (3Q)

  • Code restructuring to allow interaction with Node Pilot.
  • Design of multi-bot scheme to allow a bot running on each server and perform a unified management from a unified console in Telegram.
  • Interaction with the server (only system administrator):
    • Server status monitoring (Disk, CPU, Ram).
    • Monitoring of access to the server, ssh and access to Node Pilot.
    • Possibility of safe shutdown or restart of Node Pilot.
  • Wallet management
    • Configuration of cold wallets for automated reward delivery via configuration file.
  • Notifications to system administrator
    • Low disk space
    • System access (with whitelist of allowed IPs)
    • Possibility of blocking connected IPs in the firewall.
    • Node or chain crashes

Budget

In the past 3 months, between Iván and Luis, 180+ hours have been put into this project. This reimbursement would cover time and resources invested into:

  • Researching
  • Development
  • Testing

1st release: 30k Development and testing

2nd release: 10k development and testing + 1k Pokts/month for hosting and maintenance (1st year). Total 25k

3rd release: 20k development and testing

Dissenting Opinions

We are open to dissenting opinions. We created this because we needed to, so we’ll improve it as needed anyway. If the community finds the PoktBot useful, we would like to keep improving it and sharing all the code to help in node management.

Deliverable(s)

Phase I now available

Phase II in Jun/Jul 2022

Phase III in October/November 2022

Contributor(s)

Iván de Paz @dapwn
Luis F Monge @LuckyLuke

Copyright

https://opensource.org/licenses/MIT

4 Likes

This is a really cool project and it is a solid fulfillment of RFP-8. I’ve been aware of this project’s development for several months now and I’m excited to see it released.

I support this proposal. Great job @LuckyLuke and @dapwn!

3 Likes

One thing that I find lacking in the ecosystem right now is more open source blockchain explorer API that provides the aggregation that your bot does.

If you decouple this from your bot and add it as python library that anyone can host as a common API for any use (discord bots, web servers, etc) - I will support without hesitation.

1 Like

This is a really cool idea / project. I espicially like the ability to monitor multiple nodes with both the admin and investor roles. System-level monitoring / events like when a volume is running low on space would also be super useful.

4 Likes

Decoupling this functionality from the bot definitely makes sense as it would simplify the bot code and at the same time it would make it compatible with other platforms as you mention.

In the second and third phases of the project, we planned to make more generalizations and this can fit perfectly within the planning.

The bot already has a representation in the Python Package Index and we can add this functionality there, or we can just split it into two packages.

@LuckyLuke, maybe we can add a milestone towards this objective for the second phase. What do you think?

2 Likes

Yes @dapwn, it makes sense and fits perfectly in the second phase.
For the second phase, we have identified the need to create nodes to query the nodes locally, we are currently using the PoktScan API.
In this phase we will need to create an integration between the node and a Rest API, this can be dockerized to be deployed by anyone who needs a Rest API for their own project.
On the other hand, we can create a Python library to interact with this API Rest, which would allow the developer to be abstracted from the interaction with the node on the one hand and with the API on the other.
This would be very useful for developments of any kind that need to query information from Pocket.
@poktblade is this what you were thinking?

@steve thank you very much for your feedback! In the third phase we have many ideas for monitoring the nodes, from monitoring the server itself, sending automated rewards to a cold wallet, security monitoring, restarting nodes…

Thanks for your ideas, they helps us a lot!

3 Likes

This is great, would love to see it.

Yes, a client that consumes the rest API should also be open source.

In theory, if you look at the current networks, we have thousands of pocket nodes sitting at near idle for periods of time. Node runners should be able to spin up their own local “blockchain explorer” / “api” to aggregate data from the chain. I see this as a benefit as it moves load off PoktScan to a place that does have an abundance of compute power. As a result, these open source api’s/clients can empower future Web-ui’s, mobile apps, etc without everyone having to “recreate” their own API because it is open source. In fact, there are so many pocket nodes running at idle right now, you may not even have to pay that much in hosting since you could build a network of folks who would love to run this on top of their current fleet. It could be the first “DAO ran blockchain API”

Just an ambitious idea though, all I’m looking for is an open source blockchain explorer API that everyone can use.

TLDR:

Just make this more flexible so anyone can host and run their own queries, let that be mobile, frontend, backend, and bot developers.

3 Likes

This proposal is now up for voting Snapshot

1 Like

This proposal was approved. Snapshot

@LuckyLuke please reach out to me in Discord DMs to arrange payment.

1 Like