transferring money with steem api

in #steemdev6 years ago (edited)


hey steemians,

good the day yesterday published a post in which he talked about how to give votes in steemit using javascript code today I will explain one of the most important things as are transfers. How can you see that all the time every second a lot of transfers are made in the chain of steem but let's see more thoroughly. what they is the code that runs in the background of the data we fill for perform one transfer from our accounts to another user, without saying more we see the code that is used in javascript to make transfers:

code


steem.broadcast.transfer(wif, from, to, amount, memo, function(err, result){
console.log(err, result);
});

As you can see, the code asks for a lot of the information already used previously in the tutorials If you have not seen them leave you the previous publications at the end of this post.in the same way I will explain them in a fast way:

necessary information

there is only a small information necessary to make the transfers which is the active password this is the one that allows you to make the transfers from the steem accounts you can find it in the permission part of your wallet, by the other values I think it is not necessary to explain them since these are necessary but accessible for all, in the same way I will explain them given one so that you know what they mean.

wif : password of publication
from : account from which send the sbd or steem
to : account that receive the sbd or steem
amount : amount send in sbd or steem
memo : written note in the transfer

once the data is filled and the application runs, just like yesterday, it will generate a json file which will have the complete information of the transfer made. in the same way as yesterday we will use the code explained in my first post to verify the last transfer made.


var steem = require ('steem');
steem.api.getAccountHistory('ederaleng', -1, 0, function(err, result) {
console.log(err, result[0][1].op);
});

the answer that makes the query is a transfer with the information passed in the code this is similar to the same as yesterday but with certain since yesterday we were seeing how to make votes with javascript code and today is a transfer

array of transfers:


'transfer',
{ from: 'ederaleng',
to: 'cuenta',
amount: '1.000 SBD',
memo: 'pruebas con api steemjs' }

recommendations

at the moment of entering the value you want to send if you can see the result of the transfer, it is known what is going to be sent if it is sbd or steem, so if you know javascript you will know that any type of variable that has letters is a string for which this information must go between 'quotation marks' another thing to have in accounts is the value since if you are going to send a value less than 1 before putting it in writing in the form it shows in the code using one point as an identifier of the value.

without more to say I hope that you have served my publication and also that it has served you, thanks for reading


previous post
image sources: self image

Sort:  

Congratulations @ederaleng! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by ederaleng from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.20
TRX 0.15
JST 0.030
BTC 65641.55
ETH 2676.11
USDT 1.00
SBD 2.91