Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
/ ton-validation Public archive

Small utility to automate TON validator requests for continious validation and getting rewards

Notifications You must be signed in to change notification settings

everstake/ton-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Small utility to automate validator requests and get rewards

Please refer to Validator HOWTO Guide

WARNING! Highly experimental. Use at your own risk!

Tested on Ubuntu 18.04, using this commit.

Please backup and remove your db.json to start with a clean one before running v1.3

Required:

  • Python 3 (Tested on 3.6.8)
  • working Full-node that completed sync
  • configured lite-client and validator-engine-console
  • default keys and wallet (as shown in Validator HOWTO Guide) stored along with executables
  • executables (fift, lite-client, validator-engine-console)
  • configured env variable $FIFTPATH
  • recover-query.boc which you can obtain by running (fift -s recover-stake.fif)
  • wallet smart contract in the masterchain (-1 identifier)
  • sufficient amount of Grams for validation purposes (20k will result in continuous process of validation in testnet)
  • tonos-cli v0.1.29 - Tested to work

Installation steps:

#set env variable in .bashrc file using export, here user=ton
export FIFTPATH=/home/ton/ton-sources/ton/crypto/fift/lib:/home/ton/ton-sources/ton/crypto/smartcont
export BETTER_EXCEPTIONS=1
sudo apt install python3-pip
sudo apt install python3-venv
python3 -m venv env
if you use bash -> source env/bin/activate
#After that your promt will change
#Place requirements.txt and validator.py in directory with executables
pip install -r requirements.txt
#Run and check the output
python validator.py
#To exit run
deactivate

How to run:

Place validator.py along with executables and run

python validator.py

Important notes

Backup your node config because the script makes a lot of keys.

We recommend to check the output and the source code.

As seqno of your wallet smartcontracts changes - old .boc files are useless, so we don't keep them.

If everything is OK, these files will be periodically overwritten:

  • return-stake.boc
  • validator-to-sign.bin
  • validator-query.boc
  • finish.boc

Current dir listing before running the script:

DIR listing

Running the script:

DIR listing

Current dir listing after running the script:

DIR listing

Notes on automation

Run the script with watch for a couple of days to test it:

(env) ton@server /m/o/T/b/950e2> watch -n 1800 -d "python validator.py"

When you have checked everything you can proceed and configure running the script with cron:

*/3 * * * * cd /path/to/DIR && env/bin/python validator.py > /dev/null 2>&1

Refer to a good article about cron and python.

Logs

Script logs the results of its works to last.log file and to separate directories regarding anything about current elections.

Also, it stores stats and keys in DB file.

DB file

The db file is a json generated by TinyDB.

You can parse it by running cat db.json | jq -r '._default' | jq '[.[]]' to get readable output.

See how to get some graphs and good-looking charts at everstake/ton-helpers

About

Small utility to automate TON validator requests for continious validation and getting rewards

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages