sw/eden Notifications

WAX Guild Notifications

Introduction

There are many things that Guilds can do to optimize their services and to increase the performance both from the perspective of the community and in terms of the chain itself. When Guilds are looking into optimizing their setup it often helps to draw conclusions from looking at a wide variety of different data points from several points of view. Also in several cases it is very helpful to be able to look at this kind of data over a fairly long periods of time.

It is fairly evident that there are several guilds who could do more data analysis to try to identify patterns when looking at what could be causing current potential issues; there are often a lot of easily provable false hypothesis going around as speculation. By continously and over time exposing blockchain data from outside perspective (ours) we hope to help with mitigating this as well as several other problems.

Solution

We have built a notification system which should help interested parties to figure out patterns both when there are issues but also for day2day optimizations and also to keep track of continous performance over time from the perspective of different (or the same) guilds.

We are currently offering weekly, daily and/or hourly reports. User specific configuration is done on chain and we provide a bash script (that remember previous settings) as well as a web page to make configuration as easy as possible. Messages are sent using the users bot and bot_id / chat_id are encrypted on chain but stored unencrypted in the filesystem on the machine where the bash script is run (so it remembers the setting).

Any Guild in top21 can register to receive notifications using their producer account. Also every Guild in top21 can add 4 accounts to the whitelist table which allows those accounts to register to receive notifications as well.

Message breakdown

The messages are sent over telegram and consists of several different types of data collections that we here detail. The screenshots comes from the daily report but except for timing the others look similar:

  • Hourly: 1 hour + 1 day
  • Daily: 1 day + 7 days
  • Weekly: 7 days + 30 days

Each report can be turned on / off individually and for some the reports limits can be configured to be active at certain levels highligting specific data (can help with identifying patterns).

In regards to percentiles we currently have them set at 8, 80 and 92 (1 block is ~8.33% of a round).

Producer latency report

notify

The Producer latency report shows latency for blocks as they are received to 6 of our nodes. We have nodes running on hosts located in different parts of Sweden, Finland and Germany. This data is meant to help Guilds identify and solve potential network issues as well as to optimize cpu-effort-percent and last-block-cpu-effort-percent.

CPU Benchmark (eosmechanics)

notify

The CPU Benchmark (eosmechanics) report looks at the eosmechanics.cpu (contract.action) for the selected guild and compares this to the data for all other guilds. Since the limit is configured to be 150us for this report and since 205 > 150, avg: 205us is written in bold. The percentage after the average value shows comparison with the average for all guilds for any specific time frame.

Total CPU usage

notify

The Total CPU usage report show data per block. It is important to keep in mind that this data is self-reported; in times where there are not enough transactions in the queue to fill all blocks the worse CPU performance a producer has - the better the pure numbers will seem to be.

Block statistics extras

notify

The Block statistics extras report for now show smallest and largest blocks (in terms of self-reported CPU usage), the producers who made them and how many each producer made. It also shows avg, min and max of the transactions queue.

Setup

It is recommended to create a new bot used for this.

Create telegram bot

Send /newbot command to BotFather

notify

The bot_id when you register for receiving notifications is the bot (add "bot" before what is returned from BotFather).

Get chat id

Private

Send /start to @RawDataBot and get .message.chat.id

Group

notify

Add @RawDataBot to the group and it'll automatically post a json containing .message.chat.id. Remember that the chat will get a new id if it in the future is changed into a super group.

Sign up for notifications

Command line

Make sure /usr/opt/wax-leap/323wax01/bin/cleos exists (or edit config/chains.json) and set up wallet (keosd) so it contains proper private key for the user to be used. Then download repository:

git clone http://xebb@gitlab.sweden.wg/sw-eden/contracts/notify.git
Run script
cd notify/scripts
./register.sh

notify

bot_id and chat_id is encrypted before pushed on chain.

Web

Self explanatory. URL needed.

Planned Enhancements

  • We are working on an enhancement where we in the Total CPU usage report calculate an all Guild CPU usage average per contract.action (which we for transparency push on chain). Per action in a block we take that average and multiply that with each specific action for each action in every block. This will give us a different (better) metric to see fill-rate of blocks that will be compareable that between Guilds.
  • We are working on a better way to measure producer CPU Benchmark than to just look at the eosmechanics.cpu contract / action. The plan is to do a similar calculation as the one planned for Total CPU usage report but with the goal of showing a data comparison using real world action data
  • Adding more reports to help optimizing more things
  • Having report only active if above limit

TL;DR

Encrypting the sensitive information

We utilize OAEP:SHA256 RSA to encrypt the chatID and botID, and for the service we will decrypt it on our side. The public key will be stored on the blockchain, and the private key will be stored on our server. If you want to encrypt the information yourself, you can use the provided key below.


-----BEGIN RSA PUBLIC KEY-----

MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtG7XNrnfScgXz8Bqq/PH9iem9BNdUA0Prpw8/7TE1LljHSloG1eckm+XE10/hBOS9kxzzFdh8XpFVbhQJieLuOs/W8Jcwe/T4vzxH4wt57j314PLi643N9nRiyOD0Jz9vALw6iBr2U2sjEcDQmZt/e/2Oq9RA0WTd76f8L55ZENXimYXpynYTNmKQxkpzDng8OjKLPgjZG6Rv9q/ETYXxaM3q1J0yDFzDdHTLQGpsWmmITuvZ991FmDM7AT1z4iv47Y1jbMhzRvAZXUe/AHdYO6b44qFB5mNKafJtCcclmMm9eHmDqRc9borHFsAeKprtlWO3Ucl+YWaulWYfnGeINyNTOwfM0D9cobNCvEc24S5kr3N5gKyc9nNM96W7PiIV51F2mHWlYxTx9r0HQIPhhkYHlW3gDlY3hrmEKdQG/A4tMrAN548YXBtpgD46n6dY4ahCPZS8rOqLsMkjO0VBcmfDOmZMWRxp3JvAbo+xZrVvmb9TWHa2hfos8faqhW8HkF3+iAEdr6t74eH5ZwCQsfl/pNZhvKmUygIexpaHk0WEnoNUEPFMw7iHzGBqxnoHhFymVVCmO9wwrZhgnqH+DZGi67WTjsdr3W/13mP3IBykn3xm6S6JE049GN2lJwfMGpbVUAZrN9qS8GUPOXRMw8C8sXXOfTvqELVTsVDWLcCAwEAAQ==

-----END RSA PUBLIC KEY-----

Get current RSA key

curl -X 'POST' \ 'https://api.waxsweden.org/v1/chain/get_table_rows' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "code": "notify.se", "table": "config", "scope": "notify.se", "index_position": "", "key_type": "", "encode_type": "", "upper_bound": "", "lower_bound": "", "json":true }'