POB to Ecency: Day 14 - Getting the Data together for calculating the vote worth

Today I got a little bit closer to getting vote reward calculations right in Proof of Brain.

VotingWith1TrillionPOBPoweredUp.png

The calculation of voting reward requires five requests.
One is the balances of an account from :
https://api.hive-engine.com/rpc , you specify you want the token balances like this:

 curl -XPOST -H "Content-type: application/json" -d '{ "jsonrpc": "2.0", "method": "find", "params": { "contract": "tokens", "table": "balances", "query": { "symbol": "POB", "account": "leprechaun"}, "limit":1, "offset": 0 }, "id": 1 }' 'https://api.hive-engine.com/rpc/contracts'

Then you need to get information about the POB token

curl -XGET 'https://scot-api.hive-engine.com/info?token=POB&hive=1'

and

curl -XGET 'https://scot-api.hive-engine.com/config?token=POB&hive=1'

Then finally the various vote amounts in the POB way of seeing things:

curl -XGET 'https://scot-api.hive-engine.com/@achimmertens/weekly-statistics-for-the-dollarpob-token-qttbs0?hive=1'

This call gets you the POB price in Hive.

curl -XPOST -H "Content-type: application/json" -d '{ "jsonrpc": "2.0", "method": "find", "params": { "contract": "market", "table": "tradesHistory", "query": { "symbol": "POB"}, "limit":1, "offset": 0 }, "id": 1 }' 'https://api.hive-engine.com/rpc/contracts'

Then there is a Hive call to get the price of Hive in Dollars

curl -XPOST -H "Content-type: application/json" -d '{"jsonrpc":"2.0", "method":"database_api.get_dynamic_global_properties", "id":1}' 'https://api.hive.blog'

You can now put all of the data together yourself, and calculate the amount you should get for voting. The exact way this is calculated is done at src/app/components/elements/Voting.jsx
in the github repo: https://github.com/hive-engine/nitrous.

That is if you're really bored some day. :)

H2
H3
H4
3 columns
2 columns
1 column
12 Comments
Ecency