STEEM Autovote Bot

in #steem8 years ago (edited)

STEEM Autovote Bot

Introduction

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

  • Simple, customizable YAML configuration file
  • Allows users to monitor multiple accounts and autovote posts (not comments)
  • Multiple accounts can autovote any monitored account
  • Monitored accounts can be autovoted immediately or within a random time frame for each voting account
  • Monitored accounts can be autovoted with a prescribed frequency for each voting account
  • Upvotes only

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

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.

  • Do not allow for tabbed spaces, only single character white spaces and hard carriage returns.
  • New accounts to monitor are added in the monitor section.
  • Allow for two additional white spaces for each sub-list.
  • The outermost list is the account to monitor.
  • Voting accounts of a monitored account are items in the sub-list of a monitored account.
  • Two entries are required in the sub-list for each voting account: random_wait and frequency.

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.py python 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.

  • Use screen and navigate to the appropriate directory, and then run this process in the screened shell with python autovote-bot.py autovote.yaml
  • Use an upstart service

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 <[email protected]>"

# 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

  • Upvote with weights
  • Downvote with weights
  • Random Interval (not just from 0 to random_wait)
  • Tracking of when (auto)votes occurred and adjusting times to vote to maximize voting power for both immediate votes and queued votes

Acknowledgments

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

Sort:  

You might want to look into the steem module of piston.
After adding your keys with piston addkey you can upvotes posts with steem.upvote(identifier).

I have this error
Traceback (most recent call last):
File "autovote-bot.py", line 13, in
import dateutil.parser
ImportError: No module named dateutil.parser
How to fix please thanks
and where i can find rpc user /pw

you need to install python's dateutil.parser

try the following:

sudo easy_install pip
sudo pip install python-dateutil

thanks
Do you know where i can check my rpc user / password
And i have to put account to monitor : complexring
account to vote : otaku right?

And i have to rename example2.yaml to autovote.yaml right?

you can use any name you want. the script takes in one file as input on the command line, i.e.

python steem-autovote-bot.py example2.yaml
or
python steem-autovote-bot.py autovote.yaml

You have only Ubuntu build? No Windows?

sorry, no windows

Here is an Archive of Cryptocurrency App building Code on Github for anyone creating a Steemit app
https://steemit.com/steem/@marsresident/github-cryptocurrency-app-creation-archive

I like it. Wish I had the faintest idea how to use this. Any chance of a video setup guide? I know, I know..I ask too much!

Conditional down voting only if post has up votes above some threshold would be useful to ban punish spammers.

Could you elaborate on this?

Do you mean that monitoring the number of upvotes a post has by accounts, or within short time frame, would be decent metric for determining spammers and punishing them?

Is there any way that simpletons like us could use this without much programming knowledge requirement.

It would be of much interest if someone could do an ELI5 version of the Autovote Bot and why use Autovote Bot.

Edit : Grammar

I fully expect that at some point in the future that this will be integrated into a service through a website for non-technical users. They sign up, provide login details, we add a posting key with authority to upvote, and then users can choose their settings via a nice GUI.

As to the reason to use an autovote bot. You know accounts that provide good content, and you want to upvote them without having to go through each and every post and manually do so.

I hope this will be realized.

I'm trying to figure this out but I installed python 3.6 and from what I understood so far, this script was meant for python2. I tried updating it to make it work in python3 but I get too many errors.

Correct. Only works for python2. I will be making an update soon.

ok got it going with python 2 but getting some errors probably due to the fact that I missed the part about the open wallet. Also I'm trying to do this on windows...
could you tell me how can find my rpc user an password? Is it my username and owner password?

I'm looking forward to the update! Keep doing the things you do!

I'm still trying to get this going. When I try it I get this error :
ERROR: mapping values are not allowed here
in "", line 13, column 25:
min_random_wait : 100

so I modified the yaml (changing indent) then I get the same error for max_random_wait and frequency so I managed to get these errors out of the way by modifying the yaml some more and then I get this :

{'complexring': {'aaseb': {'min_random_wait': 100, 'max_random_wait': 800, 'frequency': 1}}}
aaseb is monitoring complexring with a random wait between 100 and 800 seconds with a probability of 1
Traceback (most recent call last):
File "path\autoupvote-bot.py", line 306, in
main()
File "path\autoupvote-bot.py", line 301, in main
monitor_loop(settings, wallet)
File "path\autoupvote-bot.py", line 200, in monitor_loop
last_block = cur_info["result"]["last_irreversible_block_num"]
KeyError: 'result'

any clues ?

Coin Marketplace

STEEM 0.31
TRX 0.11
JST 0.034
BTC 66441.00
ETH 3217.31
USDT 1.00
SBD 4.22