Hello Steemians,
In the world of Steem blockchain, understanding the intricacies of Steem Power and vesting is crucial for users looking to maximize their influence and rewards. Steem Power represents a user assets that are stake on steemit. Basically vesting is the process by which Steem Power is acquired and it can be complex to grasp. In this post, we will explore how to calculate Steem Power from vest using two key APIs and calculate the delegation amount that is given to an account.
When users delegate Steem Power to another account. they essentially transfer their voting power to that account. This delegations are measured in vesting shares that represent the Steem Power. It is not immediately tradable. To calculate vesting shares to Steem Power, one must consider the current Steem-to-vest ratio, shared below API's are needed.
Data Fetching APIs
- Steemworld Delegations API: This API provides information about incoming delegations to a specified account.
- Steemyy Vests API: This API offers data regarding the current Steem-to-vest ratio, essential for converting vesting shares into Steem Power.
Const username2 = 'beautycreativity' ;
var api1 = `https://sds.steemworld.org/delegations_api/getIncomingDelegations/${username2}`;
var api2 = `https://steemyy.com/api/steemit/vests/?cached`;
let data;
let data1;
const fetchApi1 = fetch(api1)
.then(response => response.json())
.then(apiData => {
data = apiData.result.rows;
})
.catch(error => {
console.error('Error fetching data from api1:', error);
});
const fetchApi2 = fetch(api2)
.then(response => response.json())
.then(apiData2 => {
data1 = apiData2['steem_per_mvests'];
})
.catch(error => {
console.error('Error fetching data from api2:', error);
});
Promise.all([fetchApi1, fetchApi2])
.then(() => {
function convertTimestampToReadableDate(timestamp) {
const date = new Date(timestamp * 1000);
const formattedDate = date.toUTCString();
return formattedDate;
}
function convertVestIntoSteemPower(Vest) {
const sp = ((Vest * data1) / 1e6) * 1000;
return sp;
}
const convertedArray = data.map((innerArray, index) => {
const timestamp = innerArray[0];
const Vest = innerArray[3];
const readableDate = convertTimestampToReadableDate(timestamp);
const SteemPower = convertVestIntoSteemPower(Vest);
return [index + 1, readableDate, innerArray[1], innerArray[2], SteemPower];
});
const markdownTable = `
| No | Delegator | Amount (SP) | Date & Time |
|----|-----------|-------------|-------------|
${convertedArray.map(row => `|${row[0]}|@${row[2]}|${row[4].toFixed(2)}|${row[1]}|`).join('\n')}
`;
console.log(markdownTable);
const sumSP = convertedArray.reduce((sum, row) => sum + row[4], 0);
const countrows = convertedArray.length;
}
In the above code, Delegated amount of every delegator will convert into delegated steem power from vests and store in the form of table markdown style in markdown table variable.
Please cast witness vote to bangla.Witness or set proxy to rme.
_
Vote bangla.witness as witness
Set Proxy rme as proxy
Special Thanks.
Cc: @rme
Cc: @hungry-griffin
Cc: @steemcurator01
Cc: @steemchiller
Cc: @pennsif
Thanks for giving your precious time to my post.
Follow | Upvote | Share | Comments
Follow me on Instagram.
Instagram
🆃🅷🅰️🅽🅺 🆈🅾️🆄
Thank you, friend!


I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit