Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.
/ skale-nms Public archive

DEPRECATED: SKALE Node Monitoring Service (NMS) - decentralized SLA metrics and bounty collection

License

Notifications You must be signed in to change notification settings

skalenetwork/skale-nms

NOTE: SKALE-NMS is deprecated and no longer in active maintenance. Please see sla-agent and bounty-agent repos.

SKALE Node Monitoring Service (NMS)

SKALE NMS is comprised of the SLA agent and Bounty collector, which are parts of the SKALE node.

Every SKALE node has a NMS group of N (e.g. 24) other nodes in the network randomly assigned to it. NMS groups regularly audit node downtime and latency at predetermined periods (e.g. five minutes), log these measurements to their local databases, and submit average metrics to the SKALE Manager contract (SMC) once for every reward period - epoch (e.g. 30 days). Every node is rewarded for its validation efforts, based on results sent by NMS group of this node, at the end of each epoch.

An important note about production readiness

SKALE-NMS is still in active development and therefore should be regarded as alpha software. The development is still subject to security hardening, further testing, and breaking changes. This repository has not yet been reviewed or audited for security.

Project structure

Code of SLA agent and Bounty collector are located in sla and bounty directories respectively.

SLA agent

SLA agent runs on every node of SKALE network, periodically requests a list of nodes to monitor from SKALE Manager contract, conducts monitoring of these other nodes (node downtime and latency so far), logs these measurements, and sends average metrics per epoch to SMC (once for every epoch).

Development

Requirements

Python >= 3.6.5

Install dependencies

pip install -r sla/requirements.txt

Testing

Requirements for tests

To run tests locally, you need to have MySQL v5.7 installed and database 'db_skale' and some tables created (see below). Also you have to change the name of test_data/.env_template to test_data/.env and fill it out with your environment variables:

ETH_PRIVATE_KEY='YOUR_PRIVATE_KEY' 
DB_ROOT_PASSWORD='YOUR_MYSQL_ROOT_PASSWORD'
DB_USER='YOUR_MYSQL_USER'
DB_PASSWORD='YOUR_MYSQL_PASSWORD'

As for using MySQL you have two options:

  1. Use MySQL docker container (recommended). In this case: - install Docker CE v18.06? (if you haven't it installed) - run following command:

    docker run -d --restart=always --name skale-mysql -e MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD -e MYSQL_DATABASE=db_skale -e MYSQL_USER=$DB_USER -e MYSQL_PASSWORD=$DB_PASSWORD -v test_data/init.sql:/docker-entrypoint-initdb.d/init.sql -p 3307:3306 mysql/mysql-server:5.7

  2. If you already have MySQL v5.7 installed on your PC - create db named 'db_skale' and tables with a help of this init.sql file. Keep in mind that SLA agent uses MySQL on port 3307 (not 3306)

Run tests
py.test -v tests/test_sla.py

Build and run

For building SLA agent docker container and pushing it to Docker Hub use:

cd sla
sh ./build.sh

Run docker container locally:

cd sla
sh ./install.sh

Bounty collector

Bounty agent runs on every node of SKALE network and handles the collection of the bounty over time from the SKALE Manager for its validation efforts.

Development

Requirements

Python >= 3.6.5

Install dependencies

pip install -r bounty/requirements.txt

Testing

Requirements for tests

To run tests locally, you need to have MySQL v5.7 installed and database 'db_skale' and some tables created (see below). Also you have to change the name of test_data/.env_template to test_data/.env and fill it out with your environment variables:

ETH_PRIVATE_KEY='YOUR_PRIVATE_KEY' 
DB_ROOT_PASSWORD='YOUR_MYSQL_ROOT_PASSWORD'
DB_USER='YOUR_MYSQL_USER'
DB_PASSWORD='YOUR_MYSQL_PASSWORD'

As for using MySQL you have two options:

  1. Use MySQL docker container (recommended). In this case: - install Docker CE v18.06? (if you haven't it installed) - run following command:

    docker run -d --restart=always --name skale-mysql -e MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD -e MYSQL_DATABASE=db_skale -e MYSQL_USER=$DB_USER -e MYSQL_PASSWORD=$DB_PASSWORD -v test_data/init.sql:/docker-entrypoint-initdb.d/init.sql -p 3307:3306 mysql/mysql-server:5.7

  2. If you already have MySQL v5.7 installed on your PC - create db named 'db_skale' and tables with a help of this init.sql file. Keep in mind that SLA agent uses MySQL on port 3307 (not 3306)

Run tests
py.test -v tests/test_bounty.py

Build and run

For building Bounty collector docker container and pushing it to Docker Hub use:

cd bounty
sh ./build.sh

Run docker container locally:

cd bounty
sh ./install.sh

Build all containers

To build docker containers both for SLA agent and Bounty collector use:

sh ./build_all.sh

Documentation

in process

For more information

Learn more about the SKALE community over on Discord.

Contributing

If you have any questions please ask our development community on Discord.

Discord

License

License

Copyright (C) 2018-present SKALE Labs

About

DEPRECATED: SKALE Node Monitoring Service (NMS) - decentralized SLA metrics and bounty collection

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published