Code Monkey home page Code Monkey logo

skale-nms's Introduction

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

skale-nms's People

Contributors

alexgex avatar cstrangedk avatar dependabot-preview[bot] avatar dmytrotkk avatar kladkogex avatar payvint avatar sergiy-skalelabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

pinkdiamond1

skale-nms's Issues

Modify all SLA/Bounty tests

Change a tests structure, add new tests for new enhancements, refactor existing ones, remove tests based on mocked skale.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.