Rewardo STEEM Bot v0.0.1 - Open Source NodeJS Auto Reward Claim Script

in #steemdev7 years ago (edited)

Tired of having to go to your wallet to claim your hard earned post and curation rewards? I was too! So I created Rewardo and decided to share him with the STEEM Network in order to help everyone!

Rewardo v0.0.1

Rewardo is an easy to set up NodeJS script which allows you to automate the claiming of your post and curation rewards, maximizing the amount of STEEM POWER in your account at any point in time as well as taking 1 less task off your plate! Each block it checks your account to see if you have pending rewards, if you do it automatically claims them. Set it up, run it and never worry about having to claim rewards again!

Installation & Bot Usage

Before going any further you must have NodeJS installed on your computer. As I've gone over this a few times in previous posts I'll not explain that here, but instead offer you this link to teach you how to install NodeJS. Assuming you've got NodeJS installed copy the following script below into a new file called rewardov001.js and save it.

//------------------------------------------------------------------------------
//-- Rewardo v0.0.1 | STEEM Auto Claim Reward Bot | https://steemit.com/@klye --
//----- Developed by @KLYE || Free to Use for All! || Free to Modify -------
//----- Rekuirements to run: Node.js + steem.js
//----- npm install steem --save
//------------------------------------------------------------------------------

//----- CONFIG - Make sure to fill these 2 variables in with your own values!

//----- *IMPORTANT* - Enter your account name below (no @)
var account = "username";

//----- *IMPORTANT* - Enter private posting key here
var wif = "5YOURPRIVATEPOSTINGKEYHERE";

// Declare variables and require modules (No need to modify this)
var steem = require('steem');
var rewardvests;
var rv;
var rvnum;
var rs;
var rd;
var newestblock;

//----- Check the current block on STEEM
steem.api.streamBlockNumber(function(err1, newestblock) {
  // console output to show what block we are on
  console.log("Scanning Block #" + newestblock + " for @" + account + " Rewards");
  // fetch the account to see if we have rewards
  steem.api.getAccounts([account], function(err, response){
    //if it errors
    if(err){console.log("ERROR: Something Went Wrong Grabbing @" + account +"'s Account Info!");}
    //if it works
    if(response){
      // capture output into a variable
      rewardvests = response[0];
      // set rv variable with "reward_vesting_balance" from getAccounts call
      rv = rewardvests["reward_vesting_balance"];
      // grab the float number from reward_vesting_balance to check later for rewards
      rvnum = parseFloat(rv);
      // set rs variable with "reward_vesting_steem" from getAccounts call
      rs = rewardvests["reward_vesting_steem"];
      // set rd variable with "reward_sbd_balance" from getAccounts call
      rd = rewardvests["reward_sbd_balance"];
      // console output pending rewards
      console.log("Pending Rewards: " + rd + " / " + rs + " / " + rv);
      // if reward_vesting_balance is a positive number
        if (rvnum > 0){
          // output console rewards found
          console.log("Pending Rewards Found! Claiming Now!");
          // claim rewards call
          steem.broadcast.claimRewardBalance(wif, account,'0.000 STEEM', '0.000 SBD', rv, function(err, result) {
            // if it errors
            if(err){
              // output console we error'd
              console.log("ERROR Claiming Rewards! :(");
              // output console error info
              console.log(err);
            }
            //if it works
            if(result){
              // output console we were succesful
              console.log("Woot! Rewards Claimed!");
            }//END if(result)
          });//END steem.broadcast.claimRewardBalance
        }//END if (rvnum > 0)
    }//END if(response)
  });//END steem.api.getAccounts
});//END steem.api.streamBlockNumber

Once you've got the file saved make sure to fill in your account name and private posting key within the file itself else it will not work! You can find these in your wallet on Steemit.com.

Once you've gotten your info filled in go ahead and navigate to the scripts location on your computer in command prompt, running it with the node rewardov001.js command.

It should boot up if you filled in your account name and posting private key correctly!

When it finds you have a reward it will automatically claim it for you!

Enjoy!


VOTE @KLYE FOR WITNESS

steemit.com/~witnesses
Sort:  

Nice script. But it's not claiming SBD rewards. Here's a fix.
Change this:

      if (rvnum > 0) {
        // output console rewards found
        console.log("Pending Rewards Found! Claiming Now!");
        // claim rewards call
        steem.broadcast.claimRewardBalance(wif, account, '0.000 STEEM', '0.000 SBD', rv, function (err, result) {

to this:

      if (rvnum > 0 || rd > 0) {
        // output console rewards found
        console.log("Pending Rewards Found! Claiming Now!");
        // claim rewards call
        steem.broadcast.claimRewardBalance(wif, account, '0.000 STEEM', rd, rv, function (err, result) {

..! Hell yeah man. Well done.

I just realized this after you mentioned it. Thank you for helping!

My pleasure. I've been digging into steem-js lately, it's cool stuff. Playing around with it and testing scripts :)

Wow thats very nice tool

thanks for sharing
followed
wow i'm your 2000'th follower :D

Great job @klye,

But to be honest with you nothing is more satisfying than claiming my rewards from my wallet lol.

Great job bb!

resteemed

I was wondering why no setting for this to be done automatically. Thanks for this.

It actually used to automatically deposit rewards into your account but was changed so people had to claim them maybe 2 hardforks ago or so? I missed the way it used to be so I emulated it's functionality in this script. :)

ah ok, been using for a year but only recently been active so didn't know

Yes, yet another micro-chore automated - thanks!

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 64956.33
ETH 3456.79
USDT 1.00
SBD 2.55