Steemit vote Bot like @wang for introduceyourself

in #hacking8 years ago (edited)

Hello Steemit,

yesterday i was wondering how difficult it actually is, to write a simple vote or post bot for the "introduceyourself" section. (Like @wang is doing it)

With the help of https://github.com/xeroc/python-steemlib it was actually quite easy. (I had no experience with python before). @xeroc did an amazing job with the library!

For all other user, who want to start programming on steemit:

Full python code for upvote every new post @introduceyourself

import time

from steemapi.steemnoderpc import SteemNodeRPC
from steembase import transactions

currentTime = int(time.time())

user = "yourUsername"
wif = "yourWifKey"
category = "introduceyourself"

rpc = SteemNodeRPC("wss://steemit.com/wstmp3")
for post in rpc.stream("comment", start=currentTime):
    if post["parent_author"] == '' and post["parent_permlink"] == category:
        try:
            expiration = transactions.formatTimeFromNow(60)
            op = transactions.Vote(
                    **{"voter": user,
                       "author": post["author"],
                       "permlink": post["permlink"],
                       "weight": int(10000)}
            )
            ops = [transactions.Operation(op)]
            ref_block_num, ref_block_prefix = transactions.getBlockParams(rpc)
            tx = transactions.Signed_Transaction(
                    ref_block_num=ref_block_num,
                    ref_block_prefix=ref_block_prefix,
                    expiration=expiration,
                    operations=ops)
            tx = tx.sign([wif])

            tx = transactions.JsonObj(tx)

            # Broadcast JSON to network
            rpc.broadcast_transaction(tx, api="network_broadcast")

            print("Voted!")
            print(post["title"])
        except Exception:
            print("Oops! Maybe already voted or voted to often")

You can see the second part (the post bot) here: https://steemit.com/hacking/@seagul/steemit-post-bot-like-wang-for-introduceyourself

Sort:  

tell me how to install python-steemlib on windows?

Wang shits me off