Steem.Js for dummies #7: Sending Steem/SBD to another user
Today we will learn how to use Steemjs to send a reward in either Steem or SBD to any other account.
For this, as usual, let's take a look at the documentation, that can be found on the SteemJs Github repository.
So let's take a look at the transfer function:
Here, we need five things:
Wif
, it is the private active WIF. To find it, first go to your wallet, and then to the Permissions tab, in there you will find the public active key, click on the nearby button to show the private active key that you need to realize a transfer programatically.from
is the account that will send the transferAs you can guess,
to
is the account that will receive this transfer.amount
, that's where it gets tricky, there is no information on what this transfer is about. I've never used it either, so let's try it out!
-memo
can be kept empty. it represents the message that will accompany your transfer.
steem.broadcast.transfer(XXXXXXX', 'steem-plus', 'stoodkev', 12, 'Hi', function(err, result) {
console.log(err, result);
});
Wow wow wow! Okay, there is something wrong here! Let's take a look: the function couldn't trim
, it should mean that we need to put a String in there. I'm guessing we need to specify steem or SBD with it:
steem.broadcast.transfer(XXXXXXX', 'steem-plus', 'stoodkev', '1 SBD', 'Hi', function(err, result) {
console.log(err, result);
});
Okay, still not :
After digging for a while, I finally found out that we need three decimals for the amount to be accepted:
steem.broadcast.transfer(XXXXXXX', 'steem-plus', 'stoodkev', '1.000 SBD', 'Hi', function(err, result) {
console.log(err, result);
});
Awesome, it wordked, let's check my Wallet to make sure:
That all worked, finally!
I chose to show all my trial and error process here to show you that if you stay motivated and keep digging, you can find what you need and succeed in what you want to do.
Hope this helps!
Posted on Utopian.io - Rewarding Open Source Contributors
Thats an awesome tutorial my friend, you are google star now ;)
Really? You found me on Google? haha
yeah ;)
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thanks for your work!
Nice
Thank you!
me parecio agradable aunque aun no me he sentado a usar lenguaje HTML
That's Javascript =p
Congratulations! Your post has been manually selected by @flauwy for the daily @utopian-1up curation trail. 11 Steemians/Utopians are following my trail and have upvoted your post for $1.44 in total. Join the discussion for how to make Utopian 1UP a community effort to select the best Utopian contributions of the day. You can follow the @utopian-1up trail on SteemAuto (tutorial).
Disclaimer: 1UP is in not affiliated or organized by the official Utopian.io project!
Hey @stoodkev I am @utopian-io. I have just upvoted you at 7% Power!
Achievements
Suggestions
Human Curation
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
H @stoodkev!
I've got important question and cannot find the answer.
I am trying to create bot which does something after it receives steem, but I cannot find the way to create callback something like "OnMoneyReceived".
I was trying to do it with found in library:
setPendingTransactionCallback
but it throws error and does nothing maybe you can help me?
I will send you a little tip for this and of course I will follow and upvote you.
Hi, I ll look into it, never done that so far though.
Please, I will really appropriate it. :)
Hey check my today's post. I did it for you;)
Hey, hey I've already did it and I send you a tip for your help :)
I am building something crazy right now :)
Dear @stoodkev can give an idea , How i post an image using steemjs
thanks for the knowledge