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.