steem forever (rewarding old posts) with beem

in #steemdev6 years ago (edited)

What to do when you want to reward an old post with an upvote? There are services that are doing this as steem-forever but they charge some percentage for their service.

We need a script that creates a comment under the post, set the beneficiaries and upvote the comment.
We are using beem:

pip install beem

for this. Store the following script as steem-forever.py

#!/usr/bin/python
from beem import Steem
from beem.comment import Comment
from datetime import datetime, timedelta
import time
import getpass
import argparse


def valid_age(post, hours=156):
    """
    Checks if post is within last twelve hours before payout.
    """
    if post.time_elapsed() > timedelta(hours=hours):
        return False
    return True


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("authorperm")
    parser.add_argument("votepercentage")
    args = parser.parse_args()
    authorperm = args.authorperm
    votepercentage = float(args.votepercentage)
    
    wif = getpass.getpass(prompt='Enter your posting key.')
    stm = Steem(keys=[wif])
    account = stm.wallet.getAccountFromPrivateKey(wif)

    c = Comment(authorperm, steem_instance=stm)
    if c.is_pending() and valid_age(c):
        while c.time_elapsed() < timedelta(seconds = 60 * 15):
            print("waiting that the post is 15 minute old")
            time.sleep(60)        
        c.upvote(weight=votepercentage, voter=account)
    else:
        body = "The reward of this comment goes 100 %% to the author %s. This is done by setting the beneficiaries of this comment to 100 %%." % (c["author"])
        beneficiaries = [{"account": c["author"], "weight": 10000}]
        stm.post("rewarding %s" % c["author"], body, author=account, reply_identifier=c["authorperm"], beneficiaries=beneficiaries)
        c.refresh()
        c_comment = None
        created = None
        for r in c.get_all_replies():
            if r["author"] == account:
                if created is None:
                    created = r["created"]
                    c_comment = r
                elif created < r["created"]:
                    created = r["created"]
                    c_comment = r
        while c_comment.time_elapsed() < timedelta(seconds = 60 * 15):
            print("waiting that the comment is 15 minute old")
            time.sleep(60)
        c_comment.upvote(weight=votepercentage, voter=account)
        print("Comment upvoted")

When running this script, it asks for the posting key. This key is only temporarly stored in the steem object and will be forgotten when the program exits.

Rewarding a paid out post

I selected an old post from fullnodeupdate and will reward it with my test account @beembot with a 50% upvote:

python steem-foreever.py https://steemit.com/full-nodes/@fullnodeupdate/full-api-node-update---25102018 50

A new comment is created and after 15 minutes in a loop the comment is upvoted with 50 %.
image.png
The beneficiaries are set to 100 % for giving the complete comment reward to the author.
image.png

Sort:  

Hey can you put a simple URL field running your script (with the wonderful 15min delay) in Steem-UA website and we just login with Steemconnect to upvote?

A simple single field will do, don't even need have a field to put how many minutes delay, just default it to 15min would be perfect for 99% of Steemians

And i would recommend the comment post say to that this Unlimited Upvote/Forevergreen Upvote is brought by @steem-ua and witness @holger80 with a witness vote link....i'm willing to bet tons of writers who see their old post getting reward will be super happy and wonder who you are Hoggy....you're fast rising star I see you getting to top 50 then top 30 if we can mass get your name out, most Steemians who are not programmers, which is basically 99% of them would benefit to see your name in the comments from a Curator (I think it almost implies like a recommendation or endorse for you.....bonus!)

oh yeah....last point, if it can say 100% of the reward of the comment has been reward assign to @theauthorofthispost with a steemd link as immidiate proof so everyone can see and trust steemua and holger80 (fcuk i can see this is going to be great marketing)
:D :D

That is a very interesting idea, and indeed we might implement it on https://steem-ua.com/ , to be run "as a service" for regular non-dev users.

However, I'm not a fan of referral links embedded in high-volume comments.

Also running such a "Forevergreen Upvote Service" costs server capacity, ergo we need to monetize it in case we deploy it. One option to do that, would be to auto-set @steem-ua as a 25% beneficiary by default, and add a dropdown list with other percentages (0%, 25%, 50%, 75%, 100% to steem-ua).

Just thoughts at this point, thanks for thinking out loud with your suggestion, regardless if we actually use it or not!

if folks have a choice to give @steem-ua a tip I say why not...but universal tips should be 15% and that's for great personal service....I think that if you will add this to steem-ua, default should be set it to 5% (with options for 5,10,15,20,25% would be ethical),

note: you should always match bounty's best 5% (business sense anyways, and last I heard bounty has already dropped their high end to 15%), the key is being reasonable...and please for decency do avoid 50-75-100%...what's the point of giving 100% ( :P ) to a 3rd party and 0% to the Content Creator... the point is to reward an Author with ForeverGreenNess so Steem FTW!

Thanks for replying @scipio....awesome to see you representing steem-ua and showing examplary stewardship on Steem, this is why you guys deserve the delegation from all of us!

The beneficiary percentages are just examples, don't take things too literally as in "25% is too much"! ;-) It could be 1% by default, or even 0% by default.
The numbers don't matter right now, just brainstorming ideas here...

Ha! got it buddy :D

i got gun shy...go see above the incredible ignorance of business and economic sense portrayed by some Steem business owner.....you're making sense!

Loading...

Excellent development and will help many users. I was thinking of making something like this for Whaleshares as people are upvoting my 20 days old post there.

Seems like it works great. I'm waiting for the script to finish because it waits 15 minutes after creating the comment, which is a nice feature.

Thanks, I forget to remove the set node in the steem object.
With

stm = Steem(keys=[wif])

the default configuration using a list of available nodes is used and beem can switch to the next node on failure. The script will also work with the one set node, but just in case I want to mention this.

I have an idea for an additional option/feature. Let's say that after the comment is added and before it gets a vote, the script also creates a new root post on my blog with the same beneficiary of that author but without the autovote. This root post links to the comment, and each comment by that author if I run the script multiple times for that author.

So every time this script runs, it might create a new root post if the author is new. If the script runs for the same author multiple times, the script just appends additional links in the root post.

Imagine I found a couple youtubers with great STEEM content spanning two years. So I go back and start watching their content and run this script whenever I see something I like. These two youtubers would end up being featured on my blog as two separate root posts. If I like 10 videos on one and 5 videos on the other, their related root posts on my blog show links to those videos.

The next week, a new root post is created for each author I run the script for, and so on.

Bur how to this pay out?, instantly or after a 7 day period?, and is it really worth it if you stand to lose out?, just wondering, because I have a lot of order post I like to earn on.

The payout is after 7 days, the script is just a way to upvote old, already paid-out posts.

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

Vielen Dank.

Bildschirmfoto_2018-11-04_01-44-30.png

Bildschirmfoto_2018-11-04_01-59-40.png

Ich bin kein Freund von Selbst-Votes, wäre es nicht möglich dieses auch für Beiträge anderer zumachen?

Wie stellst du dir das vor? Weil im Grunde gibst du dir da keinen selbst vote, weil die rewards komplett an den Autor geleitet werden.

Ups, vielen Dank bin gestern wohl wiedermal ein wenig daneben gewesen.

The reward of this comment goes 100 % to the author gerdtrudroepke. This is done by setting the beneficiaries of this comment to 100 %.

Hi, @holger80!

You just got a 1.04% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.227 which ranks you at #71 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 236 contributions, your post is ranked at #2. Congratulations!

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Hi, great idea but this is a little to hard to use for most people. Plus there is the 2 cent dustvote limit that most are likely to run into.

Instead, I recommend the very simple solution to just self-upvote and then send the author a tip depending on what you think is reasonable (In that case it may be as low as 0.001 steem).

I am pretty sure the 7 day payout was set in place for a reason @holger80 and if I remember correctly, it is there to keep the load on the blockchain light.