Compute the Account Voting Power (Mana) for Accounts on Steem Blockchain using Javascript/NodeJs Function
Previously, we learn how to use Javascript/NodeJs function to compute the real downvote mana/power for accounts on steem blockchain via the steem.api.getAccounts API. Today, we are going to compute the upvote mana/power instead.
Computing the upvote mana/power for accounts on Steem Blockchain is a bit easier than the downvote power. We still need to apply the restored mana since users' last upvoting activity.
function getUpvotePower(id) {
return new Promise((resolve, reject) => {
steem.api.getAccounts([id], function(err, response) {
if (err) reject(err);
const secondsago = (new Date - new Date(response[0].last_vote_time + "Z")) / 1000;
let vpow = response[0].voting_power + (10000 * secondsago / 432000);
resolve(Math.min(vpow / 100, 100).toFixed(2));
});
});
}
(async function() {
const val = await getUpvotePower('justyy');
log(val);
})();
Run this code on Steem JS Editor.
Similarly, the function returns a promise so that you can use await in an async function.
To compute the downvote power/mana: Javascript (NodeJS) Function to Get the Downvote Power of Account on Steem Blockchain
Reposted to Blog
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^
NEW! Following my Trail (Upvote or/and Downvote)
Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com
My contributions
- Steem Blockchain Tools
- Computing & Technology
- Download Youtube Video
- Find Cheap & Bargin VPS: VPS Database
- Online Software and Tools
- Online File/Video Merger
Delegation Service
Support me
If you like my work, please:
- Buy Me a Coffee, Thanks!
- Become my Sponsor, Thanks!
- Voting for me:
https://steemit.com/~witnesses type in justyy and click VOTE
- Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
- Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
- Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses
thank you
please support me @justyy
[WhereIn Android] (http://www.wherein.io)
hello @justyy
i've noticed that you have decreased the amoun of vote from 0.57 to 0.37...may i ask why?
more text more weight, and if your delegated SP is almost all of you SP, you will get more.
Hmmmm... that certainly sounds interesting... maybe I'll try it and delegate you about 500sp in the next few days and see how far that "more" can go.
Thank you for your reply and the information you provided... much appreciated.
Respect @justyy
Thank for information, i have follow u to set my proxy...
And i have delegation steem power 50SP....
Glad to work with u, greetings....