matthewniemerg / steem-autovote-bot

STEEM Autovote Bot
13 stars 15 forks source link

STEEM Autovote Bot

Introduction

STEEM Autovote is a simple autovoting solution for STEEM users. Features include :

Dependencies

STEEM Autovote has only two dependencies: PyYaml and Requests. On Ubuntu, these dependencies can be installed with the following command:

sudo apt-get install python-yaml python-requests

Depending on your system's python configuration, additional python packages may need to be installed. First, we will need to install python's pip.

sudo easy_install pip

Once pip is installed, we can install the other packages. This is accomplished with the following command:

sudo pip install python-dateutil

Configuration

Example configuration files are provided in the Examples directory as example1.yaml and example2.yaml. The configuration file is specified when calling the autovote-bot.py script:

python autovote-bot.py /home/username/autovote/autovote.yaml

Editting the yaml file may be difficult at first, but the rules are quite easy to remember.

Example Configuration File

settings :
  wallet_password : walletpword
  rpc_ip : "127.0.0.1"
  rpc_port : 8091
  rpc_user : "rpcuser"
  rpc_password : "rpcpassword"
  log_file : "autoupvote.log"
  debug : true
  monitor :
    complexring :
      your_account_name :
        random_wait : 0 # random wait time, anytime from 0 to 0 seconds
        frequency : 1 # probability that a vote will occur
      your_sock_puppet_account :
        random_wait : 100 # random wait time, anytime from 0 to 100 seconds
        frequency : .1 # probability that a vote will occur
    your_account_name :
      your_account_name :
        random_wait : 0 # random wait time, anytime from 0 to 0 seconds
        frequency : 1 # probability that a vote will occur
      your_sock_puppet_account :
        random_wait : 60 # random wait time, anytime from 0 to 60 seconds
        frequency : .5 # probability that a vote will occur
    your_sock_puppet_account :
      your_account_name :
        random_wait : 1200 # random wait time, anytime from 0 to 1200 seconds
        frequency : .333 # probability that a vote will occur
      your_sock_puppet_account :
        random_wait : 0 # random wait time, anytime from 0 to 0 seconds
        frequency : 1 # probability that a vote will occur

Random Settings

The block_id hash of the post of a monitored account is used as a seed in python's Mersennes Twister Pseudo Random Number Generator. This seed gets updated for each new post of any monitored account.

Running STEEM Autovote Bot

Running the autovote-bot script requires an open wallet, an instance of cli_wallet must be run as a daemon process, listening on an RPC port. On Ubuntu, this is best achieved using Upstart services.

Please see this guide for starting an upstart service for your cli_wallet.

Alternatively, you can run cli_wallet in an instance of a screen.

After installing screen type

screen

and then once you return to the shell, navigate to the cli_wallet directory and then type

./cli_wallet -u user -p password --rpc-endpoint=127.0.0.1:8091 -d 2>cli-debug.log 1>cli-error.log

Detach the screen with Ctrl + a and then Ctrl + x and you now have a cli_wallet daemon running.

There are at least 2 ways you can run the STEEM Autovote Bot.

Running as an Upstart Service

It is highly desirable to run the STEEM Autovote Bot as an upstart service so that on reboot and termination, a respawn of the process will occur.

Save the following script in /etc/init/steem-autovote-bot.conf (editted for your own system)

# steem-autovote-bot service - steem-autovote-bot service for user

description "STEEM Autovote bot"
author "Ima User <user@example.com>"

# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: //upstart.ubuntu.com/wiki/Stanzas

# When to start the service
start on runlevel [2345]

# When to stop the service
stop on runlevel [016]

# Automatically restart process if crashed
respawn

# Essentially lets upstart know the process will detach itself to the background
# This option does not seem to be of great importance, so it does not need to be set.
# expect fork

# Specify working directory
chdir /home/user/path/to/steem-autovote

# Specify the process/command to start, e.g.
exec /usr/bin/python autovote-bot.py autovote.yaml 2>autovote-debug.log 1>autovote-error.log

Upcoming Features

Acknowledgments

I have heavily modified the STEEM witness steemed's source code for creating a STEEM Price Feed.