create account

drphil.rb - Voting Bot Update / Fixes by inertia

View this thread on: hive.blogpeakd.comecency.com
· @inertia · (edited)
$1.11
drphil.rb - Voting Bot Update / Fixes
#### Fixes

* Fix for nodes that stop responding.
* Fix for dynamic rep loading more frequently on lower limits.

#### New Features

* Now checking for new HF18 `cashout_time` value (of present).
  * This will skip voting when authors edit their old archived posts.
* Now checking `vote_weight: 0.00 %` and skipping without broadcast.
  * This is useful for special configurations that *only* vote for favorites.
* Now voting for favorites irregardless of rep.
* Optionally configure `voters` as a separate filename.  E.g:
  * `voters: voters.txt`
    * The format for the file is just: `account wif` (no leading dash, separated by space)
  * Or continue to use the previous format.
* Also optional support for separate files in each (format one per line or separated by space or both):
    * `favorite_accounts`
    * `skip_accounts`
    * `skip_tags`
    * `flag_signals`
    * `vote_signals`

#### Features

* YAML config.
  * `winfrey` mode that acts like the winfrey bot, all voters vote for everyone
  * `drphil` mode one random voter votes for everyone (default)
  * `min_rep` (default `25.0`)
  * `min_wait` and `max_wait` so that you can fine-tune voting delay.
  * `favorite_accounts` list and separate `favorites_vote_weight` option.
  * `enable_comments` option to vote for post replies (default false).
  * `only_first_posts` option to only vote on an author's first post (default false).
  * `max_rep` option, useful for limiting votes to newer authors (default 99.9).
  * `vote_signals` account list.
    * Optionally allows multiple bot instances to cooperate by avoiding vote swarms.
    * If enabled, this feature allows cooperation without sharing keys (in `drphil` mode).
  * `min_rep` can now accept either a static reputation or a dynamic property.
    * Existing static reputation still supported, e.g.: `25.0`
    * Dynamic reputation, e.g.: `dynamic:100`.  This will occasionally query the top 100 trending posts and use the minimum author reputation.
* Skip posts with declined payout.
* Skip posts that already have votes from external scripts and posts that were edited.
* Argument called `replay:` allows a replay of *n* blocks allowing you to catch up to the present.
  * E.g.: `ruby drphil.rb replay:90` will replay the last 90 blocks (about 4.5 minutes).
* Thread management
  * Counter displayed so you know what kind of impact `^C` will have.
  * This also keeps the number of threads down when authors edit before Dr. Phil votes.
* Now streaming on Last Irreversible Block Number, just to be fancy.

#### Overview

Dr. Phil (`drphil.rb`) is reimplementation of the "Winfrey" voting bot specification.  The goal is to give everyone an upvote.

One optional improvement is that instead of voting 1% by 100 accounts like the Winfrey bot spec, this script can vote 100% with 1 randomly chosen account.

If the complaint about Winfrey is blockchain bloat, Dr. Phil prescribes weight loss to address this. But this feature would only work if there are enough voters defined in the script.  If you plan to use this script for one or two accounts, you'll probably want to adjust the `VOTE_WEIGHT` constant to something a bit lower.

---

#### Install

To use this [Radiator](https://steemit.com/steem/@inertia/radiator-steem-ruby-api-client) bot:

##### Linux

```bash
$ sudo apt-get install ubuntu-dev-tools ruby-full git openssl libssl-dev
$ gem install bundler
```

##### macOS

```bash
$ gem install bundler
```

I've tested it on various versions of ruby.  The oldest one I got it to work was:

`ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-darwin14.4.0]`

First, clone this gist and install the dependencies:

```bash
$ git clone https://gist.github.com/61bcc2b821aa5acb24f7fc88921950c7.git drphil
$ cd drphil
$ bundle install
```

Then run it:

```bash
$ ruby drphil.rb
```

Dr. Phil will now do it's thing.  Check here to see an updated version of this bot:

https://gist.github.com/inertia186/61bcc2b821aa5acb24f7fc88921950c7

---

#### Upgrade

Typically, you can upgrade to the latest version by this command, from the original directory you cloned into:

```bash
$ git pull
```

Usually, this works fine as long as you haven't modified anything.  If you get an error, try this:

```
$ git stash --all
$ git pull --rebase
$ git stash pop
```

If you're still having problems, I suggest starting a new clone.

---

#### Troubleshooting

##### Problem: What does this error mean?

```
drphil.yml:3: syntax error, unexpected ':', expecting end-of-input
mode: winfrey
     ^
```

##### Solution: You ran `ruby drphil.yml` but you should run `ruby drphil.rb`.

---

##### Problem: Everything looks ok, but every time Dr. Phil tries to vote, I get this error:

```
Unable to vote with <account>.  Invalid version
```

##### Solution: You're trying to vote with an invalid key.

Make sure the `.yml` file `voter` items have the account name, followed by a space, followed by the account's WIF posting key.  Also make sure you have removed the example accounts (`social` and `bad.account` are just for testing).

---

<center>
  ![](http://i.imgur.com/qUZYLiQ.png)
</center>

See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)

## Get in touch!

If you're using Dr. Phil, I'd love to hear from you.  Drop me a line and tell me what you think!  I'm @inertia on STEEM and [SteemSpeak](http://discord.steemspeak.com).
  
## License

I don't believe in intellectual "property".  If you do, consider Dr. Phil as licensed under a Creative Commons [![CC0](http://i.creativecommons.org/p/zero/1.0/80x15.png)](http://creativecommons.org/publicdomain/zero/1.0/) License.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 936 others
properties (23)
authorinertia
permlinkdrphil-rb-voting-bot-update-fixes
categoryradiator
json_metadata{"tags":["ruby","steem","steemdev","curation"],"users":["inertia"],"image":["http://i.imgur.com/qUZYLiQ.png","http://i.creativecommons.org/p/zero/1.0/80x15.png"],"links":["https://steemit.com/steem/@inertia/radiator-steem-ruby-api-client"],"app":"hiveblog/0.1","format":"markdown"}
created2017-03-31 04:55:03
last_update2021-04-26 16:09:21
depth0
children9
last_payout2017-04-07 04:55:03
cashout_time1969-12-31 23:59:59
total_payout_value1.000 HBD
curator_payout_value0.111 HBD
pending_payout_value0.000 HBD
promoted25.022 HBD
body_length5,675
author_reputation346,568,901,399,561
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id2,905,239
net_rshares11,448,459,047,749
author_curate_reward""
vote details (1000)
@aboylal ·
So if I run it it will query me for my private key, then I enter and its sweet, correct?
properties (22)
authoraboylal
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20170610t061517396z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2017-06-10 06:12:45
last_update2017-06-10 06:12:45
depth1
children0
last_payout2017-06-17 06:12:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length88
author_reputation130,789,392,890
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,515,491
net_rshares0
@binkley ·
Dr Phil is running great. It is similar to fossbot kinda. Thank you for making so many great tools.
properties (22)
authorbinkley
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20170813t185748905z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2017-08-13 18:57:48
last_update2017-08-13 18:57:48
depth1
children0
last_payout2017-08-20 18:57:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length99
author_reputation2,427,294,020,876
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,712,462
net_rshares0
@cheetah ·
Hi! I am a robot. I just upvoted you! Readers might be interested in similar content by the same author:
https://steemit.com/radiator/@inertia/drphil-rb-voting-bot-update
👍  
properties (23)
authorcheetah
permlinkcheetah-re-inertiadrphil-rb-voting-bot-update-fixes
categoryradiator
json_metadata""
created2017-03-31 04:55:45
last_update2017-03-31 04:55:45
depth1
children0
last_payout2017-04-07 04:55:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length170
author_reputation942,693,160,055,713
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,905,241
net_rshares3,107,068,030
author_curate_reward""
vote details (1)
@frankbacon ·
Bots such as this were the inspiration for a recent [Piece](https://steemit.com/creativity/@frankbacon/0-1-prologue-this-is-not-a-manifesto-block-warofart).
That and creative plagiarism ; )

![Imgur](http://i.imgur.com/LuNVW3H.jpg)

1200 Votes?!?!  Wow!
properties (22)
authorfrankbacon
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20170331t060337945z
categoryradiator
json_metadata{"tags":["radiator"],"image":["http://i.imgur.com/LuNVW3H.jpg"],"links":["https://steemit.com/creativity/@frankbacon/0-1-prologue-this-is-not-a-manifesto-block-warofart"],"app":"steemit/0.1"}
created2017-03-31 06:03:36
last_update2017-03-31 06:03:36
depth1
children0
last_payout2017-04-07 06:03:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length253
author_reputation38,509,879,409,111
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,905,531
net_rshares0
@kemy ·
get me along @steemit
properties (22)
authorkemy
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20180215t021813547z
categoryradiator
json_metadata{"tags":["radiator"],"users":["steemit"],"app":"steemit/0.1"}
created2018-02-15 02:18:54
last_update2018-02-15 02:18:54
depth1
children0
last_payout2018-02-22 02:18:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation3,417,564,149
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id37,622,266
net_rshares0
@noganoo ·
You have been very helpful to the Bot Net.  Thank you @inertia.  I'll remain supporting you for ages to come for this.
👍  
properties (23)
authornoganoo
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20170331t202107838z
categoryradiator
json_metadata{"tags":["radiator"],"users":["inertia"],"app":"steemit/0.1"}
created2017-03-31 20:21:15
last_update2017-03-31 20:21:15
depth1
children0
last_payout2017-04-07 20:21:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation-12,409,054,499,907
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,911,056
net_rshares0
author_curate_reward""
vote details (1)
@pipes ·
Someone promoted your post. Promotions help every steemians. 
Your [reward](https://steemit.com/steem/@tibonova/introducing-pipes) is an upvote and 0.022 SBD extra promotion. 
Good job, see you next time in `Promoted`! ;)
👍  
properties (23)
authorpipes
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20170331t184158031z
categoryradiator
json_metadata{"tags":["radiator"],"links":["https://steemit.com/steem/@tibonova/introducing-pipes"],"app":"steemit/0.1"}
created2017-03-31 18:41:57
last_update2017-03-31 18:41:57
depth1
children0
last_payout2017-04-07 18:41:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length221
author_reputation5,564,763,471,483
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,910,234
net_rshares13,188,510,579
author_curate_reward""
vote details (1)
@steemthat ·
I'm going to attempt to add a comment feature that is optional similar to the way you have it for drotto. So that members of https://SteemThat.com community know when the Auto Share feature is working other than just seeing the upvote plus perhaps we could craft a message to help get the word out more. If I'm successful I get the code to you so that you can have this version as well. Thank you for all of your hard work!
properties (22)
authorsteemthat
permlinkre-inertia-drphil-rb-voting-bot-update-fixes-20180210t221300824z
categoryradiator
json_metadata{"tags":["radiator"],"links":["https://SteemThat.com"],"app":"steemit/0.1"}
created2018-02-10 22:13:00
last_update2018-02-10 22:13:00
depth1
children1
last_payout2018-02-17 22:13:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length423
author_reputation1,483,266,589,954
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id36,513,926
net_rshares0
@steemthat ·
It was a success. It took me a while to do it but it works. You probably could have done it in 30 minutes but I had to really learn what each line of code was doing in order to use your radiator scripts to add to the drphil. While I was going through the code I found the "Seinfield" which was neat to see and think about how it could be used in a positive way. Thank you for creating these tools in a fun language. If you would like to see my hack job I'll try to upload it to my github or bitbucket soon.
properties (22)
authorsteemthat
permlinkre-steemthat-re-inertia-drphil-rb-voting-bot-update-fixes-20180211t230739979z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-02-11 23:07:42
last_update2018-02-11 23:07:42
depth2
children0
last_payout2018-02-18 23:07:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length506
author_reputation1,483,266,589,954
root_title"drphil.rb - Voting Bot Update / Fixes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id36,778,599
net_rshares0