Post Promoter JavaScript Voting Bot - Update 7 - Fighting Spam and Abuse!
image source: pixabay.com
As I mentioned in my last update, my next focus for the Post Promoter voting bot software was implementing a number of features to help curb spam and abuse on the Steem blockchain - or at least prevent it from buying upvotes.
The majority of the features that have been implemented were suggested by @themarkymark who, along with @patrice, does a lot of great work on the spam and abuse fighting front. I would like to make sure they get the recognition they deserve for that. I don't have the time to do what they do, but I try to contribute what I can through my development efforts to support them.
Anyway, let's get right down to it...
Local / Remote Blacklist File Support
There is now a configuration setting called "blacklist_location" in the config.json file which allows the bot owner to specify the location of the blacklist file that the bot should use. The location can be either a file location on the local server, or a URL of a remotely hosted blacklist file. This will allow bot owners to set up a global blacklist file that can be easily used by all bots running the Post Promoter software.
The blacklist file (whether local or remote) should simply be a text file with one Steem account name per line. You can see an example global blacklist file here: http://steembottracker.com/blacklist.txt and set up in the Post Promoter software to use it like so:
"blacklist_location": "http://steembottracker.com/blacklist.txt"
Refund Options for Blacklisted Bids
There is now an option for whether or not blacklisted users' bids should be refunded to them. In all cases that I'm aware of bot owners do not refund bids from blacklisted users, however I believe that users of the software should still have the option to do so if they wish.
"refund_blacklist": true/false,
Additionally, bot owners now also have the option to automatically donate bids from blacklisted users to an account of their choice. The idea being that such bids can be automatically donated to a spam/abuse fighting service such as @steemcleaners, @spaminator, @cheetah, etc.
"blacklist_donation_account": "steemcleaners"
Finally, the bot now replies to blacklisted users with a 0.001 STEEM or SBD transfer (whichever currency the bid was in) informing them that their account has been blacklisted from using the bot.
Spam/Abuse Flag Signal Accounts List
The third change that was added to help fight spam and abuse was to add a list of accounts that act as signals for spam/abuse posts. This means that when a bid comes in for a post, the software will check if any of the accounts on the list have flagged that post, and if so it will consider the post blacklisted and handle the bid amount based on the blacklist settings mentioned above.
"flag_signal_accounts": ["spaminator", "cheetah", "steemcleaners", "mack-bot", "blacklist-a"]
So for example if a bid comes in for a post that @steemcleaners has flagged, then based on the above list the software will consider that an invalid bid, send the sender a 0.001 STEEM/SBD transfer informing them their bid is invalid because the post has been flagged as spam or abuse, and donate the bid amount to the specified spam/abuse fighting service.
Fixed Issues with Auto-Failover
This is unrelated to fighting spam and abuse, but since the previous update where the auto RPC node failover feature was implemented a few issues have cropped up with it. Namely that sometimes a transaction actually fails for a legitimate reason not caused by an issue with the RPC node but that still triggered a failover. Then the transaction was re-tried, failed again, and triggered another failover. If for any reason there were a couple transactions that failed in a short period of time a whole bunch of failovers were triggered which caused "mayhem" as it was kindly put in the reported issue :-)
Luckily the fix was pretty simple - the code now checks if a failed transaction was due to an "assert_exception", meaning there was an error with the transaction itself, not with the RPC node, and if so it doesn't include that failure in the error count for triggering a failover.
Show Some Code!
It was suggested in my last post that I take some time to show the code behind some of these changes - which is a great idea since this is a development-focused site and all! Let me know what you think of this and if it's received well I'll continue to do this in all my posts going forward.
Here is the snippet of code that checks if an account on the "flag_signal_accounts" list has flagged/downvoted the post:
steem.api.getContent(author, permLink, function (err, result) {
if (!err && result && result.id > 0) {
// Check if this post has been flagged by any flag signal accounts
if(config.flag_signal_accounts){
var flags = result.active_votes.filter(function(v) { return v.percent < 0 && config.flag_signal_accounts.indexOf(v.voter) >= 0; });
if(flags.length > 0) {
handleFlag(sender, amount, currency);
return;
}
}
}
});
Got it? Don't worry - I'll break it down a bit! The first step is to load the post content which is also necessary to check that it's a valid post in the first place. That is done using the steem.api.getContent() call in the Steem JS library.
I check to make sure it doesn't return an error and that the "result", which is an object containing the post data, has an "id" that is greater than 0 - meaning it is a valid post. Then I check if there is a "flag_signal_accounts" property set in the config.json file using "config.flag_signal_accounts".
The next line is the actual meat of the code:
var flags = result.active_votes.filter(function(v) { return v.percent < 0 && config.flag_signal_accounts.indexOf(v.voter) >= 0; });
Let's take that one piece at a time. First, if you remember, "result" is an object containing all of the data about the post. "result.active_votes" is an array of all of the votes data (including upvotes and downvotes/flags) that have been submitted for the post so far.
I call the filter() function on the list of active votes for the post which filters out only the votes in the list which return "true" when passed through the function supplied as the first argument. The function is as follows:
function(v) {
return v.percent < 0 &&
config.flag_signal_accounts.indexOf(v.voter) >= 0;
}
The "v" parameter represents an individual vote object. Here we check if the "percent" property of the vote is less than 0. This means that the vote is a downvote or flag. The "percent" property indicates the weight of the vote, so if you give a 20% upvote on a post then the "percent" property for your vote will be 2000 (Steem multiplies all percents by 100). Similarly if you give a 20% downvote on a post then the "percent" property will be -2000.
So we check simply if the "percent" property is less than 0 to indicate a downvote of any weight, and then next we check to see if the list of "flag_signal_accounts" in the config.json settings contains the name of the "voter" property in the vote object. If it does then that means one of the accounts in the list downvoted the post and the function will return the value "true".
Finally we check the "length" of the result of the filter call to see if one or more of the votes in the active_votes list for the post returned "true" from our function. If so then that means the post has been flagged by an account on the list and should be treated as blacklisted.
If that happens then the handleFlag() function is called which handles notifying the sender that their post has been flagged and their bid is invalid, and optionally donating the bid amount to the specified spam/abuse service. Then a "return" statement is executed which exits the current function call so nothing else happens with that particular bid.
Thanks for your support!
Wow that was much longer than most of my contribution posts! If you've made it this far then thank you very much for reading...I hope this has helped you learn a bit about how these things are developed! As always I want to thank everyone who has helped and supported me in creating this software. Please stay tuned for more updates in the coming weeks!
Links to relevant commits:
- Added flag signal accounts list
- Allow loading blacklist from a URL
- Fixed issues with multiple errors causing "mayhem"
- Added new blacklist options
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved. Just wanted to make sure that the Image used in the post is made by you, if not, can you please state the Source.
You can contact us on Discord.
[utopian-moderator]
Updated to state image source, thanks for pointing that out!
@yabapmatt this is a great service you have. Is there any way for the bot to "not" post the upvote message? Thanks so much. (Voted for you as a witness by the way) :-)
The decision over whether or not a bot comments on posts it votes is up to the bot owner. I've considered removing the comment from @postpromoter but it provides significant visibility to the service and to myself. Additionally some people like the messages as a sort of disclosure that the post has received a paid upvote.
So for the time being I intend to continue having the bot comment on posts it votes, but there are some other bots, like @buildawhale, that don't leave a comment as far as I am aware.
Thank you for your support!
The spam and abuse protection are great to build value and help out good content creators. Thanks for providing well commented code and breaking it down.
Thanks for the awesome post. Should I be a Steem witness to have my own bot?
Being a witness is completely unrelated to running a voting bot.
@yabapmatt, please forgive me if this is off-topic, but I'd like you to consider removing @boomerang from the list of upvote bots as it is either broken or intentionally stealing people's money. Simply go to @boomerang and look at the list of complaints in the blog comments. I personally think it's intentional and have lost money because of it. Please show me that you are a responsible "bottracker" and will do the right thing. Thank you.
Thank you for reaching out. I will speak to the owner of the @boomerang bot and see what is being done about any issues it is having. I definitely remove bots that are not working properly or scamming users from the site, but @boomerang has been around for a long time and I do not want to make any decisions too hastily.
I understand and thanks for your reply! I am relatively new here, and this was my second or third time using boomerang and I've only had the one problem. My concern came when I saw how many others this is happening to. You have renewed my faith in steembottracker.com. Thanks for your service!
@yabapmatt was there a resolution or answer? Honestly there seems to be a lot going on with the bots lately as I'm seeing more and more complaints. I've stopped using them altogether because I cannot tell which ones to trust anymore. Your help on this matter would help many more than myself. Thank you.
@artopium yes I have spoken to the owner of @boomerang and it seems they have been having some technical issues lately. He has assured me that they are working on it and plan to refund anyone who had a missed bid including yourself.
As for being able to trust the voting bots my recommendation would be to use the ones with both the auto-refund icon and the purple check mark icon as those will be the most reliable.
I run the @postpromoter voting bot myself and personally guarantee that it will work correctly or your money back.
great guy @yabapmatt
you have been very resourceful and valuable to us especially with your website for bots. my question is,
how do one know the list of bots that upvotes instantly withing 1 min of paying for bot from those that are bid based and can last hours.
also how do one seperate those bots that leave a comment from those that dosnt leave a comment but srites in wallet informing you name of bot used in upvote. like the latter for privacy sake.
more so, how do one know the lowest and highest bid and value of the bid at a particular time?
how long does bot using last , will it be affected in next hardfok update or has it come to stay?
need proper guide to use the service better
The bid-based voting bots section lists all of the bid-based bots that only vote every 2.4 hours or so. You can try the Content Promotion services section for quicker upvotes, although I don't know if they will be within 1 minute or not.
I don't currently show which bots leave comments on posts and which don't, but if you just check some posts that the bot has voted on recently you can see which ones comment.
I don't know exactly what will be in the next hardfork, but based on what has been announced it should not have any effect on voting bots. In general there's nothing that can really stop people from selling their votes.
i think you are right since steemit is all about freedom and these bots do help a lot to keep us minnows abreast with top whales and a good business option to gain some extra steem and sbd. thanks and i hope in your updates or upgrades you seperate those who comment from those who dont cos some use it to gain double by advertising in folks comment section which many of us dont find funny. thanks once more for your time and good works
Thank you for the contribution
Hi Yapbamatt, love to see how the tool is improving. I would like to see some features in the future though;
Thanks for reading and look forward to a better bid market to be created in the near future. Highly appreciate your work.
Hey @yabapmatt! I actually just set up a bot using your postpromoter code and it works wonderfully! The only issue I have.. I would like to have it listed on the bot tracker website.. but I'm running the bot from my laptop through a personal hotspot. I can't get an SSL certificate as far as I know... Please get back to me when you can regarding the matter. I want my bot to only upvote posts less than 4 hours old, I think that it's the first of it's kind, that I've seen! (At least on the website! :P)
Thank you in advance!
_Kain
I'm guessing you've been busy, just wanted to check up on this and see if you'd be willing to list it. If so, I will delegate power to it and set it to run. Let me know when you can. Thank you! :)
I've set it to accept posts up to 6 hours old and a max bid of 0.01 to ensure that it gets shared between more people and those with more money don't just come in and suck up all the vote's value. Get back to me when you can, hope all is well @yabapmatt! :)
And I have more money that I plan on buying power with, so it will actually be profitable for the bidders if I get the green light. lol
Sorry to be a bother.. I just noticed you had replied to other people recently..
I was still wondering if I could get listed on your site.
I am holding off on buying power for the bot until I have the final word from you about the SSL and hotspot situation.
Thanks again. :)
_Kain
I travel for business, so I always have my laptop on me.
It runs basically 24/7 and if it were to shut off, it would be in my immediate vicinity, so I could restart it within minutes in the event of a failure of some sort. :)
Hello, I've asked this before to some one in a post before, but I never got an answer.... What exactly is considered abuse? using the bot too many times or something? Are you allowed to use it once a day?
There isn't a clear cut definition of what is considered abuse, but usually it's pretty clear cut. Abusers typically make many posts a day with no real content, often on multiple accounts, and use bots to constantly upvote all of them.
If you are writing actual content and using the bots to promote it you should not have any problem and you can use them more than once a day.
ok, great. Thank you. I wanted to make sure that as long as I was making a good post, that I could use any number of bots.