voting the posts with code of javascript

in #steemdev6 years ago (edited)


hey steemians,

The day of yesterday I posted about how see the transactions of the accounts by means of javascript code, so the today i will speak about how vote the posts by means code javascript.first of nothing remember that you pc should have the librery or dependens necesary for run and perform any query in the blockchain of steem this is nodejs and librarys for part of the librarys for Steem blockchain it was explained how to install them in the post of yesterday If you did not see the publication yesterday I will leave it at the end of this post.

information of necessary to vote a post

To vote for a publication, certain is required one information this information is the what identify the post among all those who circulate in the network the information that is necessary is:

  • name of your accoun
  • password of posting private
  • permalink of publication(we will explain what is)
  • autor the post
  • percentage of vote

once you have that information, you do not need any other parameter to vote the people's posts through javascript and only is enter the parameters in the function and the post has been voted

function javascript to vote publications


steem.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
console.log(err, result);
});

as it was said the function asks for certain data these would be entered in the following way:

wif=password of publication
voter=name of your account
author=nombre del autor de la publicación
permlink=is the text that there is after the username in the link of the publication for example

weight=porcentaje de voto con el que desea ver la publicación 10000 es el 100%

remember that all files that are not numbers must go between 'quotes' since they are string of text. When you have all the data in the function , it's just saving the file and run in the console this will vote a small code with the information of the transactions made of the next way.


[ [ 4003,
{ trx_id: 'f70c6e5cb37a4e5dbf89a9c3d5784b99f4bcd672',
block: 23126277,
trx_in_block: 24,
op_in_trx: 0,
virtual_op: 0,
timestamp: '2018-06-07T23:05:09',
op: [Array] } ] ]

If you enter more thoroughly using the [] these will give us more information on the operation performed the code would be as follows


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

if you have any questions leave your comment without more to say I hope you liked my post and also that has been to your liking

image sources 1

Sort:  

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.30
TRX 0.12
JST 0.033
BTC 64029.44
ETH 3157.04
USDT 1.00
SBD 4.02