create account

regult.rb - Proxy Sentinel by inertia

View this thread on: hive.blogpeakd.comecency.com
· @inertia · (edited)
$17.93
regult.rb - Proxy Sentinel
#### Overview

Regult (regult.rb) is a proxy sentinel that streams the blockchain, looking for proxy/unproxy operations to update a local text file with a list of accounts that proxy their witness vote to a particular account you're interested in tracking.

In addition to streaming the blockchain, in order to save time and resources, this script will also initialize the list from data on Steem SQL.  Since Steem SQL [is a paid service](https://steemit.com/steemsql/@arcange/steemsql-is-moving-to-a-monthly-subscription-model), I figure using Steem SQL should be optional.  If you can manually initialize the `proxy-list.txt` file using some other method, using Steem SQL should not be required.

It's also *possible* to just let Regult build the `proxy-list.txt` file from the Genesis block, but that's a bad idea if you're using a public node.  Don't do that.

---

#### Install

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

##### Linux

```bash
$ sudo apt-get update
$ sudo apt-get install ruby-full git openssl libssl1.0.0 libssl-dev
$ sudo apt-get upgrade
$ 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.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin17]`

First, clone this gist and install the dependencies:

```bash
$ git clone https://gist.github.com/cfce5b47fa0f5b1eae0c6dd9c653ca7d.git regult
$ cd regult
$ bundle install
```

You should edit `regult.yml` and point it at the correct account (`proxy_target_account`).

If you intend to use Steem SQL, you can provide the credentials in `authorize-steem-sql.sh`, then use this terminal command to enable Steem SQL just before running this script:

```bash
source authorize-steem-sql.sh
```

Now you can skip to `ruby regult.rb`.

Otherwise, if you do not intend to use Steem SQL, in order to avoid long replays, get a list of accounts that currently proxy to `proxy_target_account` and create a file called `proxy-list.txt` with the entire list of account names only, one account name per line (you can typically get this list from steemdb.com, for example: https://steemdb.com/@jesta/proxied is a list of accounts that proxy to jesta).

Then create a file called `last-block-num.txt` and add a single line with the latest block number, or whatever number you'd like to begin streaming from.

Once those two files exist, you can run this script and the `proxy-list.txt` file will be kept current whenever a relevant proxy/unproxy operation is seen.

Then run it:

```bash
$ ruby regult.rb
```

Regult will now do it's thing.  Check here to see an updated version of this script:

https://gist.github.com/inertia186/cfce5b47fa0f5b1eae0c6dd9c653ca7d

---

#### 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?

```
regult.yml:1: syntax error, unexpected ':', expecting end-of-input
```

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

##### Problem: The node I'm using is down.

Is there a list of nodes?

##### Solution: Yes, special thanks to @jamzed.

https://geo.steem.pl/

---

<center>
  <a href="https://www.deviantart.com/randychen/art/Robotech-enemy-pod-392359533">
    <img src="https://orig00.deviantart.net/848b/f/2015/325/a/d/robotech_enemy_pod_by_randychen-d6hlmjx.jpg" />
  </a>
  <br />
  <sub>art by <a href="https://www.deviantart.com/randychen/">randychen</a></sub>
</center>

See my previous Ruby How To posts in: #radiator #ruby

## Get in touch!

If you're using Regult, 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 Regult 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.
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorinertia
permlinkregult-rb-proxy-sentinel
categoryradiator
json_metadata{"tags":["radiator","ruby","steem","steemdev","witness-category"],"users":["jamzed","inertia"],"image":["https://orig00.deviantart.net/848b/f/2015/325/a/d/robotech_enemy_pod_by_randychen-d6hlmjx.jpg","http://i.creativecommons.org/p/zero/1.0/80x15.png"],"links":["https://steemit.com/steemsql/@arcange/steemsql-is-moving-to-a-monthly-subscription-model","https://steemit.com/steem/@inertia/radiator-steem-ruby-api-client","https://steemdb.com/@jesta/proxied","https://gist.github.com/inertia186/cfce5b47fa0f5b1eae0c6dd9c653ca7d","https://geo.steem.pl/","https://www.deviantart.com/randychen/art/Robotech-enemy-pod-392359533","https://www.deviantart.com/randychen/","http://discord.steemspeak.com","http://creativecommons.org/publicdomain/zero/1.0/"],"app":"steemit/0.1","format":"markdown"}
created2018-06-28 03:21:12
last_update2018-06-29 04:42:12
depth0
children9
last_payout2018-07-05 03:21:12
cashout_time1969-12-31 23:59:59
total_payout_value14.189 HBD
curator_payout_value3.736 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,340
author_reputation346,568,901,399,561
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,561,194
net_rshares7,171,414,032,861
author_curate_reward""
vote details (40)
@cryptorg · (edited)
$5.33
Nice organized post, but while I follow your posts I must say that I still face some issues to understanding the tools and their use. Maybe in the overview you can put up some examples and explain at what the tool is used for in a more "human" way as I would really like to learn, but not sure from were to start when I find such information. I know that it all makes sense for you as you are like the fish in the water with all these technologies and tools, but I think that explaining a little bit with a broad sense would make others follow and try these new things. Thanks, nevertheless!
πŸ‘  
properties (23)
authorcryptorg
permlinkre-inertia-regult-rb-proxy-sentinel-20180628t190308057z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-06-28 19:03:09
last_update2018-06-28 19:03:57
depth1
children2
last_payout2018-07-05 19:03:09
cashout_time1969-12-31 23:59:59
total_payout_value3.997 HBD
curator_payout_value1.330 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length591
author_reputation8,806,415,131,458
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,652,555
net_rshares2,157,257,573,229
author_curate_reward""
vote details (1)
@inertia ·
It solves a problem that cannot be solved by typical methods.  In this case, say I want to know all of the accounts that proxy their witness votes to me at any given time.  The blockchain knows, but it’s not telling.  This script figures it out without needing to read the entire 824 days worth of blocks from beginning to end.
properties (22)
authorinertia
permlinkre-cryptorg-re-inertia-regult-rb-proxy-sentinel-20180629t044945783z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-06-29 04:49:45
last_update2018-06-29 04:49:45
depth2
children1
last_payout2018-07-06 04:49: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_length327
author_reputation346,568,901,399,561
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,696,230
net_rshares0
@cryptorg ·
Nice trick to get that info revealed using this script, thanks for the info!
properties (22)
authorcryptorg
permlinkre-inertia-re-cryptorg-re-inertia-regult-rb-proxy-sentinel-20180629t160018747z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-06-29 16:00:18
last_update2018-06-29 16:00:18
depth3
children0
last_payout2018-07-06 16:00:18
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_length76
author_reputation8,806,415,131,458
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,759,692
net_rshares0
@kaliju · (edited)
I'm learning so much from your commits @inertia! Thank you for all your work man. By the way, a question I've been meaning to ask: why did you go with Ruby to begin with? Did you know how to code in ruby before? If I understand it correctly, there are things like SteemPy that can achieve similar results, correct? Just curious to know your reasons from a programmer's perspective. Thanks again!

<center><sup><sub>CREATE YOUR OWN @REVIEWME PROFILE TO START EARNING *CREDIBILITY STARS* FROM THE COMMUNITY! 

[CREATING YOUR PROFILE IS EASY! JUST FOLLOW THE STEPS HERE](https://steemit.com/reviewme/@reviewme/how-to-create-your-very-own-reviewme-page-start-earning-credibility-stars-get-reviewed-by-steemians) ☜(Λ†β–ΏΛ†c)

[You can trade your earned credstars for SBD!](https://steemit.com/reviewme/@reviewme/your-reputation-on-steemit-should-be-rewarded-earn-sbd-with-your-reviewme-profile-41dd9704cbff7)
</sub></sup></center>
properties (22)
authorkaliju
permlinkre-inertia-regult-rb-proxy-sentinel-20180628t033551912z
categoryradiator
json_metadata{"tags":["radiator"],"users":["inertia","reviewme"],"links":["https://steemit.com/reviewme/@reviewme/how-to-create-your-very-own-reviewme-page-start-earning-credibility-stars-get-reviewed-by-steemians","https://steemit.com/reviewme/@reviewme/your-reputation-on-steemit-should-be-rewarded-earn-sbd-with-your-reviewme-profile-41dd9704cbff7"],"app":"steemit/0.1"}
created2018-06-28 03:36:27
last_update2018-06-28 03:37:00
depth1
children2
last_payout2018-07-05 03:36:27
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_length921
author_reputation34,142,096,389,326
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,562,353
net_rshares0
@inertia ·
$0.34
I've been meaning to post about why I'm into ruby.  But in a nutshell, I got into it in 2004 when Ruby on Rails started getting popular.  And I've been working with it professionally since 2012.
πŸ‘  
properties (23)
authorinertia
permlinkre-kaliju-re-inertia-regult-rb-proxy-sentinel-20180628t034728787z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-06-28 03:47:27
last_update2018-06-28 03:47:27
depth2
children1
last_payout2018-07-05 03:47:27
cashout_time1969-12-31 23:59:59
total_payout_value0.330 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length194
author_reputation346,568,901,399,561
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,563,256
net_rshares138,271,094,413
author_curate_reward""
vote details (1)
@kaliju ·
Cool stuff, you're motivating me to learn more and your tools are a dream come true for anyone who's starting to study the steem blockchain and the different languages one can use. A post on your history with Ruby would be nice!
properties (22)
authorkaliju
permlinkre-inertia-re-kaliju-re-inertia-regult-rb-proxy-sentinel-20180628t035855387z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-06-28 03:59:30
last_update2018-06-28 03:59:30
depth3
children0
last_payout2018-07-05 03:59:30
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_length228
author_reputation34,142,096,389,326
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,564,248
net_rshares0
@transparencybot ·
@inertia You have received a [random](https://steemit.com/@transparencybot/the-daily-coverup-transparency-under-attack-6-29-18) upvote from @botreporter & @bycoleman because this post did not use any [bidbots](https://steemit.com/introduceyourself/@transparencybot/transparency-bot-is-going-on-line-to-help-fight-the-rampant-rise-in-bitbots-and-their-long-term-devastating-effect-on-our).

πŸ‘  
πŸ‘Ž  , ,
properties (23)
authortransparencybot
permlinkre-regult-rb-proxy-sentinel-inertia-botreporter-randomvote
categoryradiator
json_metadata{"tags":["botreporter","random-upvote"],"users":["inertia","transparencybot","botreporter","bycoleman","transparencybot"],"links":["https://steemit.com/@transparencybot/the-daily-coverup-transparency-under-attack-6-29-18","https://steemit.com/introduceyourself/@transparencybot/transparency-bot-is-going-on-line-to-help-fight-the-rampant-rise-in-bitbots-and-their-long-term-devastating-effect-on-our"],"app":"null/null","format":"markdown"}
created2018-06-30 02:58:57
last_update2018-06-30 02:58:57
depth1
children2
last_payout2018-07-07 02:58: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_length392
author_reputation-5,641,716,862,244
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,814,467
net_rshares-86,949,084,112
author_curate_reward""
vote details (4)
@abusereports ·
$1.77
@transparencybot you're on the @abusereports naughty list for being a super douche!<br><br>**Bad Steemian! Bad!**
πŸ‘  , , , , ,
properties (23)
authorabusereports
permlinkabusereports-re-transparencybotre-regult-rb-proxy-sentinel-inertia-botreporter-randomvote
categoryradiator
json_metadata""
created2018-06-30 02:59:06
last_update2018-06-30 02:59:06
depth2
children0
last_payout2018-07-07 02:59:06
cashout_time1969-12-31 23:59:59
total_payout_value1.331 HBD
curator_payout_value0.436 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation199,407,425,243,286
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,814,479
net_rshares729,658,110,147
author_curate_reward""
vote details (6)
@iflagtrash ·
$1.04
# Vote for witness @nextgencrypto!<br><br>Thank you for the free promotion @transparencybot and @bycoleman!<br><br>![image](https://i.imgur.com/UDPUUAd.jpg)
πŸ‘  , , , , ,
properties (23)
authoriflagtrash
permlinkiflagtrash-re-transparencybotre-regult-rb-proxy-sentinel-inertia-botreporter-randomvote
categoryradiator
json_metadata""
created2018-06-30 02:59:03
last_update2018-06-30 02:59:03
depth2
children0
last_payout2018-07-07 02:59:03
cashout_time1969-12-31 23:59:59
total_payout_value0.783 HBD
curator_payout_value0.256 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length156
author_reputation14,709,692,204,215
root_title"regult.rb - Proxy Sentinel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,814,473
net_rshares429,410,445,797
author_curate_reward""
vote details (6)