Introducing SteemBot, an open source library to easily create real-time automation on top of Steem

in steemdev •  last year

During the last week I spent a significant part of my time on developing a solution for easier automation on top of Steem blockchain. The final result is an open source library called SteemBot which can easily help new developers to develop automation on top of Steem. Whether they are developers of exchanges and need to receive deposits or they are wales and want to create a bot like @randowhale, this library can help them to bootstrap their idea quickly.

Problem

I get the idea from the fact that many new developers introduced to the platform are lost since it's difficult for them to familiarize with how things works here.

Many devs think that it's only the lack of documentation for the current solution like steem-js which causes this problem but I believe no matter how much you add to the documents, the low-level design nature of these libraries are the real issue for most of these developers.

That's why I developed SteemBot as a high-level designed API to make it much easier to build real-time apps for Steem.

What you can do with it?

Most of the common operations are included. However, I need to add some more functionality and make the API stable soon for the release of version 1.0.0.

At this moment, it is possible to do these things:

  • Receive Deposits
  • Send SBD
  • Send STEEM
  • Trigger new Posts on the platform (for some users or all users)
  • Trigger new Comments on the platform (for some users or all users)
  • Upvote
  • Flag (downvote)
  • Upvote based on the link on memo (like vote selling bots)
  • Comment based on the link on memo

Technical

How it looks like?

Here is how you can use it to receive deposits for your service:

const bot = new SteemBot();

// will be triggered on any deposit to poloniex and bittrex
bot.onDeposit(['poloniex', 'bittrex'], (data) => {
  console.log(data); 
});

Can you make something good with it?

You probably know about vote selling bots like randowhale which will deposit 2 STEEM or SBD from you and upvote your post which the link is in the memo of your money transfer. You should have probably thought implementing such a bot would be really hard. Many things to consider and the real implementation is probably above 100 lines of code.

Let's see how you can write a bot like randowhale in SteemBot:

import SteemBot from 'steem-bot';

const bot = new SteemBot({
  username: 'your username',
  postingKey: 'your private posting key'
});

bot.onDeposit((data, responder) => {
  if (data.amount < 2) return;
  
  const randomVote = (Math.random() * 4).toFixed(2) + 1;

  responder.upvoteOnMemo(randomVote);
  responder.commentOnMemo(`This post received a ${randomVote}% upvote from @randowhale thanks to @${data.from}! For more information, click here!`); 
});



Can you believe it to be that simple? Well the mechanism is the same but the real implementation has more edge cases, like sending back the money if it's less than 2 or if the user forgot to add a correct steemit link as memo. Also should calculate a random number between 1 and 5. So for the sake of perfection, I also wrote the full implementation of randowhale as one of the examples of SteemBot which you can see below.

Full implementation of randowhale bot using SteemBot [click here]

Installation

NPM package is available. You should be fine to use it with any supported node-js version but feel free to report any issue:

npm install steem-bot --save

Then include the package on top of your file:

const SteemBot = require('steem-bot').default
// or if your environment supports import/export:
import SteemBot from 'steem-bot';

How to use?

Go to the Github page of the library for full source code and documentation. Also three examples are available for you to get started.

Examples

  • Depositing Steem or SBD from users click here
  • Auto voting on every new post from a list of users click here
  • Randowhale popular bot, full implementation click here

Further development

This package is still under development. Feel free to use it and feedback using github issues.

Versioning

This package is using Semantic versioning to make sure changes in API will not break your bots.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Cool! Tip! 1

What a great help! Thank you!

·

Your welcome! Let me know if you used and had any problem.

·
·

I'll probably give it a try! Not too soon, because I am occupied with other projects right now, but I have bookmarked it... ;)

·
·
·

Good to know. I will continue developing it from the next month. Let me know if you had any issues.

·
·
·
·

@p0o
nice one..i mentioned you on my post... hope you dont mind.. thanks

Steemians who want to invest on the bot to sell votes can adopt your project... this is very helpful to user who is not a code savvy.

'bots will be the death of Steemit.

·

Also exchanges not being able to easily get deposits will do the same.

·
·
·
·
·

Not sure what you mean

·
·
·
·

hardware wallet.

Thanks for your work, but I think automation is bad for steemit. It turns steemit into a social bot platform. There are without doubt very useful things you can do with automation, like scheduled posting etc, but upvoting, downvoting etc is a very bad idea and doesn't help steemit grow.

I don't say I will not use it, because if everybody uses it so should I, but bots in general is not good for Steemit. People don't curate anymore, they just upvote the same author again and again.

·

Automation is used by exchanges to receive their funds. Also for the case of upvote and downvote, many of the spams lately triggered by flagging bots written by developers. Also when it comes to bots, people see spam bots, not seeing the possibility of future for having intelligent bots helping the community in many ways. Think about the possibility of using machine learning algorithms for Steem.

·
·

You are right, but the question what will people use it for. When the internet was invented people thought it will be used for good things. But from the beginning on the web became a place for adult content and other illegal stuff, even before the good stuff arrived.
I think that most people will use automation tools for their own benefit, not looking for Steemit's benefit.

·
·
·

What you are trying to imply with your example? That internet is a bad thing because we have adult websites?

·
·
·
·

That you invent something for the goods, and people take it and use it for the bad. You say that your bot COULD be used for good things, you are right. But you tell me: What do you think people will use it for?

·
·
·
·
·

I'm an engineer, I make tools that devs need. The matter that how people are going to use it is irrelevant to me. Some will use it for good and some for bad. I shouldn't limit the knowledge in the fear of bad things happening. That's against freedom and never leads to great results. You think you can stop bad things happening with limiting people to only good? That never worked.

Good! Thanks for sharing! This make easier thinks :D

great post, thanks for sharing

This post was very informative thank you for sharing
you have my upvote
Keep smiling, reading, writing and voting!!!
@mannyfig1956

Hi @p0o! @cardboard is sending you 1.0 SBD tip and @tipU upvote :)

send tips with @tipU | earn interest in @tipU profit

Congratulations @p0o! You have received a personal award!

Happy Birthday - 1 Year on Steemit Happy Birthday - 1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.

For more information about this award, click here

By upvoting this notification, you can help all Steemit users. Learn how here!

Hi I have a question about your bot. How can I contact you?

·

I think you figured out to use github issues for that. I already sent you a reply there so please check it out and let me know. Thanks.

Congratulations @p0o! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:

SteemFest³ - SteemitBoard support the Travel Reimbursement Fund.

Support SteemitBoard's project! Vote for its witness and get one more award!