How to calculate Steem Power using the API

in #steem7 years ago (edited)

I've seen a lot of discussions on how Steem Power is actually calculated. In this post I will show a concrete example using JavaScript and the WebSocket API.


The forumla for calculating Steem Power is as follows:

total_vesting_fund_steem * (user's vesting_shares / total_vesting_shares)

I won't go into details what these are but here is a good article outlining the concepts of vests.


This script retrieves the relevant values in the formula and calculates Steem Power for @lantto:

var totalVestingShares, totalVestingFundSteem;

var socket = new WebSocket('wss://'),
    account = 'lantto';

socket.onopen = function(event) {
    socket.send(JSON.stringify({id: 1, method: 'get_dynamic_global_properties', 'params': []}));

socket.onmessage = function(event) {
    var steemPower, vestingShares;

    var data = JSON.parse(;

    if ( === 1) {
        totalVestingShares = data.result.total_vesting_shares.split(' ')[0];
        totalVestingFundSteem = data.result.total_vesting_fund_steem.split(' ')[0];

        socket.send(JSON.stringify({id: 2, method: 'get_accounts', params: [[account]]}));

    if ( === 2) {
        vestingShares = data.result[0].vesting_shares.split(' ')[0];
        steemPower = totalVestingFundSteem * (vestingShares / totalVestingShares);


Go ahead and replace lantto with your own username and paste the code into the Chrome DevTools console. It should output your current Steem Power.

This is how Steem Power is calculated everywhere. We can verify this by looking at the source code of where they're using a utility function very similar to the code above.

Let me know if you have any questions!

Credits by @xeroc and @jesta
How to calculate the Market Capitalization of Steem by @dantheman
Developers Guide to Steem's Blockchain by @furion


Nice. Always convenient to check concrete examples now and then. Cheers!

Awesome. it's working!

Coin Marketplace

STEEM 0.17
TRX 0.08
JST 0.022
BTC 26621.37
ETH 1590.35
USDT 1.00
SBD 2.17