Another example, of how I use py-steem by @xeroc. This time I'm using the Blockchain class, that was part of steemtools by @furion. This script will follow votes from authors in a list, called <code>voter_list</code>. Just replace <code>pk</code> and <code>account</code> with your posting key(s) and account(s). # Code from steem import Steem from steem.blockchain import Blockchain chain = Blockchain() voter_list = ["felixxx"] pk = ["5GH56thyouwishlol67zPO9hkO9HKP6gthz8"] account = ["votebot"] steem = Steem(keys=pk[0], node="wss://node.steem.ws") for operation in chain.ops(): op = operation["op"] if op[0] == "vote": #print(op) #uncomment this to get an idea of the format comment_voter = op[1]["voter"] if comment_voter in voter_list: comment_link = op[1]["permlink"] comment_author = op[1]["author"] vote_weight = int(op[1]["weight"]/100) comment = steem.get_post("@" + comment_author + "/" + comment_link) if comment.is_main_post(): print("vote by: " + comment_voter + " for " + comment_link + " weight:" + str(vote_weight)) for (k,v) in enumerate(account): try: steem = Steem(keys=pk[k], node="wss://node.steem.ws") comment.vote(vote_weight, v) print("... followed with " + v + " with " + str(vote_weight) + "%") except Exception as e: print("... NOT followed with " + v + " because:") print(str(e)) ___ Known issues: - This bot might try to cast multiple votes within too little time ( When multiple accounts in <code>voter_list</code> vote at the same time ) ___ At the end of the day, this script does nothing more than streemian can already do. ( While streemian is more reliable ) However, I can now try out to take a vote by a trusted author to trigger an event. Next function I will include is <code>vote_check</code>, like I use for @deutschbot, to see if other trusted authors have already liked the comment, with a <code>treshold</code> from 0-1. # Code def vote_check(c_comment, curators, threshold): votercount = 0 checked = False check_comment = steem.get_content(c_comment.identifier) for avote in check_comment['active_votes']: if (avote['voter'] in curators and avote['percent'] > 0): votercount = votercount + 1 vote_ratio = (votercount / len(curators)) if vote_ratio >= threshold: checked = True return checked ___ I post these examples, so you have some working examples of code. Both functions are tested and work. They are not very clever and might cause some issues, but it's something to build up on. I don't believe curation should be done with simple algorithms. I, personally, would maybe deploy the first script, for when I'm on holiday, so I can just follow someone I trust in his curation-efforts. Mainly, this post is for educational purposes. <center>http://i.imgur.com/Bhzj9O7.png</center> I would really appreciate if more people tried this out, so I have someone to talk to, when I run into problems. # Have fun !
author | felixxx |
---|---|
permlink | python-steem-example-follow-votes |
category | python |
json_metadata | {"tags":["python","py-steem","curation"],"users":["xeroc","furion","deutschbot"],"image":["http://i.imgur.com/Bhzj9O7.png"],"app":"steemit/0.1","format":"markdown"} |
created | 2017-01-27 14:23:30 |
last_update | 2017-01-27 14:23:30 |
depth | 0 |
children | 14 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.823 HBD |
curator_payout_value | 0.101 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 3,374 |
author_reputation | 214,877,046,020,983 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 2,357,595 |
net_rshares | 10,511,907,655,524 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
wang | 0 | 151,408,004,320 | 57% | ||
proctologic | 0 | 47,755,460,107 | 100% | ||
proctologic2 | 0 | 894,585,400 | 100% | ||
makishart | 0 | 10,843,897,409 | 100% | ||
proctologic3 | 0 | 814,689,558 | 100% | ||
richman | 0 | 118,467,715,960 | 100% | ||
nxtblg | 0 | 465,759,546,128 | 100% | ||
kevinwong | 0 | 960,078,936,026 | 100% | ||
murh | 0 | 812,476,400 | 5% | ||
cryptofunk | 0 | 14,426,317,349 | 100% | ||
juanmiguelsalas | 0 | 62,062,606,913 | 100% | ||
crok | 0 | 658,695,117 | 10% | ||
fyrstikken | 0 | 112,422,141,204 | 5% | ||
skapaneas | 0 | 19,085,533,276 | 100% | ||
ericvancewalton | 0 | 930,568,131,547 | 100% | ||
slowwalker | 0 | 808,946,711,577 | 100% | ||
bycz | 0 | 16,317,525,143 | 100% | ||
lichtblick | 0 | 138,543,606,916 | 100% | ||
febird | 0 | 13,596,662,942 | 100% | ||
moon32walker | 0 | 105,285,865,461 | 100% | ||
ace108 | 0 | 26,656,480,185 | 70% | ||
originate | 0 | 291,890,508,381 | 100% | ||
uwe69 | 0 | 15,493,317,129 | 100% | ||
shaka | 0 | 684,555,835,423 | 100% | ||
shortcut | 0 | 82,137,128,746 | 100% | ||
ap2002 | 0 | 111,175,325 | 100% | ||
felixxx | 0 | 69,681,326,374 | 100% | ||
dumar022 | 0 | 53,478,325,307 | 100% | ||
twinner | 0 | 1,136,136,584,191 | 100% | ||
germansailor | 0 | 3,382,887,955 | 100% | ||
achim86 | 0 | 25,852,041,893 | 100% | ||
elena000 | 0 | 320,682,738 | 100% | ||
steemradio | 0 | 928,309,853 | 100% | ||
herbertmueller | 0 | 2,393,885,948 | 100% | ||
bhavnapatel68 | 0 | 37,882,465,614 | 100% | ||
ioc | 0 | 774,653,456,272 | 100% | ||
nextgen622 | 0 | 22,260,798,909 | 100% | ||
matrixdweller | 0 | 578,747,469 | 1% | ||
gammagooblin | 0 | 7,973,357,388 | 100% | ||
abarefootpoet | 0 | 3,612,844,786 | 100% | ||
neptun | 0 | 408,438,587,574 | 100% | ||
nang1 | 0 | 637,408,887 | 100% | ||
steevc | 0 | 23,999,460,451 | 100% | ||
andrewawerdna | 0 | 37,686,552,790 | 100% | ||
sethlinson | 0 | 3,510,777,720 | 20% | ||
hilarski | 0 | 36,238,873,847 | 20% | ||
sumiiit | 0 | 350,372,985 | 100% | ||
ines-f | 0 | 7,560,991,360 | 100% | ||
alktoni | 0 | 9,070,926,449 | 100% | ||
englishtchrivy | 0 | 78,803,345,353 | 100% | ||
stephenkendal | 0 | 11,009,752,060 | 100% | ||
pollux.one | 0 | 68,860,503,126 | 100% | ||
daveks | 0 | 98,109,365,746 | 70% | ||
l0k1 | 0 | 7,645,265,622 | 10% | ||
jsg | 0 | 59,950,128,576 | 100% | ||
magetanbonar | 0 | 2,713,862,198 | 100% | ||
z3r0d4yz | 0 | 1,224,501,579 | 100% | ||
bitcoinparadise | 0 | 1,706,486,467 | 10% | ||
saamychristen | 0 | 7,573,548,262 | 100% | ||
nelyp | 0 | 27,189,220,904 | 100% | ||
dirkzett | 0 | 216,963,051,669 | 100% | ||
votebot | 0 | 51,919,130 | 100% | ||
arama | 0 | 1,980,086,812,809 | 100% | ||
meerkat | 0 | 1,010,028,356 | 21% | ||
dresden | 0 | 38,232,888,735 | 90% | ||
majes | 0 | 20,773,082,412 | 100% | ||
freiheit50 | 0 | 25,155,958,148 | 100% | ||
digit | 0 | 3,520,110,990 | 100% | ||
jdbry | 0 | 2,455,206,306 | 100% | ||
steemspeak | 0 | 225,974,465 | 2% | ||
fyrst-witness | 0 | 356,448,499 | 2% | ||
idnit | 0 | 2,672,909,403 | 100% | ||
lovethepeople | 0 | 135,764,678 | 100% | ||
whiskylover | 0 | 2,441,280,269 | 100% | ||
xochicotta | 0 | 14,322,688,307 | 100% | ||
porco-bastardo | 0 | 131,925,089 | 100% | ||
sqube | 0 | 2,953,619,869 | 3% | ||
trans-juanmi | 0 | 6,594,713,472 | 60% | ||
muhtadiaremi | 0 | 1,615,909,663 | 50% | ||
mrfoot | 0 | 1,453,345,984 | 100% | ||
steemer0815 | 0 | 871,955,332 | 100% | ||
mistere | 0 | 528,161,272 | 100% | ||
gas7uazz | 0 | 704,339,551 | 100% | ||
idnit1 | 0 | 1,739,694,197 | 100% | ||
bottymcbotface | 0 | 298,553,616 | 100% | ||
cardboard | 0 | 6,419,360,789 | 100% | ||
gildar | 0 | 1,130,080,132 | 100% | ||
juliosalas | 0 | 832,542,203 | 60% | ||
cherished | 0 | 411,818,116 | 100% | ||
the-architect | 0 | 411,840,946 | 100% | ||
germanlifestyle | 0 | 3,331,141,697 | 100% | ||
tamersameeh | 0 | 498,700,998 | 100% | ||
idnit0 | 0 | 898,893,459 | 100% | ||
witidnit10 | 0 | 443,808,170 | 100% | ||
smileyface | 0 | 353,191,502 | 100% | ||
angels | 0 | 413,311,875 | 100% | ||
springtime | 0 | 344,781,707 | 100% | ||
delightful | 0 | 353,138,269 | 100% | ||
charm | 0 | 353,182,129 | 100% | ||
simplest | 0 | 344,695,489 | 100% | ||
fibra59 | 0 | 6,335,068,579 | 100% | ||
idnit2 | 0 | 842,569,945 | 100% | ||
idnit3 | 0 | 663,296,880 | 100% | ||
idnit4 | 0 | 647,345,030 | 100% | ||
idnit5 | 0 | 640,940,942 | 100% | ||
idnit6 | 0 | 654,920,460 | 100% | ||
idnit7 | 0 | 650,000,972 | 100% | ||
idnit8 | 0 | 637,833,408 | 100% | ||
idnit9 | 0 | 1,668,298,431 | 100% | ||
victorious | 0 | 344,632,221 | 100% | ||
legends | 0 | 404,163,313 | 100% | ||
darth-azrael | 0 | 2,748,627,957 | 100% | ||
dzone | 0 | 39,291,183,908 | 100% | ||
robertneleson | 0 | 880,147,292 | 100% | ||
ogochukwu | 0 | 2,309,571,031 | 100% | ||
benjiparler | 0 | 343,024,858 | 100% | ||
unprovoked | 0 | 0 | 0% | ||
no0balot | 0 | 0 | 100% |
I upgraded python-steem and my old bot stopped working with key errors and all sorts. Luckily I had a snapshot from weeks ago and reverted back. Think the old breed of bots will need to be rewritten :O
author | cryptofunk |
---|---|
permlink | re-felixxx-python-steem-example-follow-votes-20170127t213511544z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 21:35:12 |
last_update | 2017-01-27 21:35:12 |
depth | 1 |
children | 7 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 201 |
author_reputation | 22,006,702,786,195 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,360,420 |
net_rshares | 14,426,317,349 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
cryptofunk | 0 | 14,426,317,349 | 100% |
I'm running the latest and bot #1 above doesn't seem to work for me. No errors but it just sits there when I know it should be doing something. However, the older version I had complained about the import blockchain line. Playing around with it, it seems like it is just getting stuck at the "for operation in chain.ops():" line. I double checked my posting key and account but I'm not sure what else to try. I'm running the winfrey bot and that seems to work ok.
author | darth-azrael |
---|---|
permlink | re-cryptofunk-re-felixxx-python-steem-example-follow-votes-20170127t214606411z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 21:46:06 |
last_update | 2017-01-27 21:47:12 |
depth | 2 |
children | 5 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 464 |
author_reputation | 213,767,279,239,191 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,360,487 |
net_rshares | 0 |
There was a bug, it's fixed now. You need to clone into the <code>develop</code> branch of py-steem I should have mentioned that above ...
author | felixxx |
---|---|
permlink | re-darth-azrael-re-cryptofunk-re-felixxx-python-steem-example-follow-votes-20170127t215631047z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 21:56:33 |
last_update | 2017-01-27 21:56:33 |
depth | 3 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 140 |
author_reputation | 214,877,046,020,983 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,360,548 |
net_rshares | 0 |
try initializing Steem like this Steem(node="wss://node.steem.ws")
author | felixxx |
---|---|
permlink | re-darth-azrael-re-cryptofunk-re-felixxx-python-steem-example-follow-votes-20170127t230025739z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 23:00:27 |
last_update | 2017-01-27 23:00:27 |
depth | 3 |
children | 3 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 71 |
author_reputation | 214,877,046,020,983 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,360,912 |
net_rshares | 0 |
There was a bug, it's fixed now. You need to clone into the <code>develop</code> branch of py-steem
author | felixxx |
---|---|
permlink | re-cryptofunk-re-felixxx-python-steem-example-follow-votes-20170127t215546848z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 21:55:48 |
last_update | 2017-01-27 21:55:48 |
depth | 2 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 100 |
author_reputation | 214,877,046,020,983 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,360,543 |
net_rshares | 0 |
@felixxx I wish I could but I suck at programming :( I hope you find someone who'd try this!
author | englishtchrivy |
---|---|
permlink | re-felixxx-python-steem-example-follow-votes-20170127t202016115z |
category | python |
json_metadata | {"tags":["python"],"users":["felixxx"],"app":"steemit/0.1"} |
created | 2017-01-27 20:20:09 |
last_update | 2017-01-27 20:20:09 |
depth | 1 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 92 |
author_reputation | 190,105,027,681,254 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,359,933 |
net_rshares | 0 |
@felixxx Hello. An unrelated comment. I referred to your old post abou NiceHash [here](https://steemit.com/nicehash/@ervin-lemark/first-payout-at-nicehash-miner). Still mining?
author | ervin-lemark |
---|---|
permlink | re-felixxx-python-steem-example-follow-votes-20170129t203600524z |
category | python |
json_metadata | {"tags":["python"],"users":["felixxx"],"links":["https://steemit.com/nicehash/@ervin-lemark/first-payout-at-nicehash-miner"],"app":"steemit/0.1"} |
created | 2017-01-29 20:36:21 |
last_update | 2017-01-29 20:36:21 |
depth | 1 |
children | 3 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 180 |
author_reputation | 468,103,602,931,986 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,374,414 |
net_rshares | 0 |
I stopped using nicehash. I tried mining PASCAL. ( no blocks ) Now I*m not mining at all
author | felixxx |
---|---|
permlink | re-ervin-lemark-re-felixxx-python-steem-example-follow-votes-20170130t075708695z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-30 07:57:09 |
last_update | 2017-01-30 07:57:09 |
depth | 2 |
children | 2 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 88 |
author_reputation | 214,877,046,020,983 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,378,187 |
net_rshares | 0 |
:)
author | ervin-lemark |
---|---|
permlink | re-felixxx-re-ervin-lemark-re-felixxx-python-steem-example-follow-votes-20170130t080326925z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-30 08:03:27 |
last_update | 2017-01-30 08:03:27 |
depth | 3 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2 |
author_reputation | 468,103,602,931,986 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,378,206 |
net_rshares | 0 |
lol, mining takes a bit to get going, I got old hardware, but it is mining.
author | smysullivan |
---|---|
permlink | re-felixxx-re-ervin-lemark-re-felixxx-python-steem-example-follow-votes-20170131t085500403z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-31 08:55:00 |
last_update | 2017-01-31 08:55:00 |
depth | 3 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 75 |
author_reputation | 16,261,876,135,297 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,387,124 |
net_rshares | 140,584,268 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
pfunk10 | 0 | 136,741,145 | 1% | ||
seraph | 0 | 212,609,987 | 1% | ||
asshole | 0 | -208,766,864 | -1% |
I'll try to have a play at the weekend. I may run a Pi Zero to do this for me. It has a matrix display, so I could show updates on there. Will let you know how I get on.
author | steevc |
---|---|
permlink | re-felixxx-python-steem-example-follow-votes-20170127t143554742z |
category | python |
json_metadata | {"tags":["python"],"app":"steemit/0.1"} |
created | 2017-01-27 14:35:54 |
last_update | 2017-01-27 14:35:54 |
depth | 1 |
children | 0 |
last_payout | 2017-02-27 15:07:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 169 |
author_reputation | 1,371,148,197,611,199 |
root_title | "Python-Steem Example: Follow Votes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,357,693 |
net_rshares | 69,681,326,374 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
felixxx | 0 | 69,681,326,374 | 100% |