/selfdeleg

Cosmos ecosystem self-delegating bot

Primary LanguagePython

Self Delegator Bot

A simple self delegator bot for any Blockchain on the Cosmos ecosystem
Forked from the Desmos bot

Requirements

  • A cosmos blockchain CLI
  • Python >= 3

1. Install

git clone https://github.com/lorenzoPrimi/selfdeleg.git && cd selfdeleg && mkdir logs

2. Configuration

mv template.ini config.ini && nano config.ini

And edit:

  1. CLIENT with your client command name, and UNIT with the smallest unit of the token
  2. KEY_NAME with your validator key name, and KEY_BACKEND if you use a different keyring backend.
    If you use the test keyring, in the future steps you can replace the password inputs with spaces/random characters
  3. VALIDATOR_ADDRESS, USER_ADDRESS, DELEGATE_ADDRESS, with your addresses. If you want to self delegate, USER_ADDRESS and DELEGATE_ADDRESS should match.
  4. If you are installing the bot in a machine that is not running a node/validator configure DEFAULT_NODE_ADDRESS and DEFAULT_NODE_PORT with remote nodes addresses
  5. MINIMUM_BALANCE amount of JUNO that the bot will always keep (minimum 1 JUNO)
  6. The other configuration values are optional

3. Run

To run the bot, use:

python3 bot.py

This will ask for the keyring password at first, if you don't want to you can use

python3 bot.py password

3. Run as a Service (Ubuntu/Linux)


sudo nano ./start.sh

and change the password:

#!/bin/bash

source ~/.profile
/usr/bin/python3 $HOME/selfdeleg/bot.py password

Then,
sudo nano /etc/systemd/system/selfdeleg.service

and paste changing accordingly the User path and username:

[Unit]
Description=Juno Self Delegator Bot
After=network-online.target


[Service]
WorkingDirectory=/home/ubuntu/selfdeleg/
User=ubuntu
Type=simple
Restart=always

ExecStart=/bin/bash /home/ubuntu/selfdeleg/start.sh


[Install]
WantedBy=multi-user.target

Now you can reload and start the service
sudo systemctl daemon-reload
sudo systemctl start selfdeleg

To follow the daily output:
tail -f ./logs/debug.log