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.
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. :)
Leave POB to Ecency: Day 14 - Getting the Data together for calculating the vote worth to:
Read more #hive-150329 posts
Best Posts From Leprechaun
We have not curated any of leprechaun's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Leprechaun
- The false Morality of Regulation
- Self Port Scanning Tool Available
- When a prospective employee asks for your public key
- Japanese Bombed Pearl Harbor Four Score and four years ago
- Once A Novel Way to Sweeten Things, now Documented Mental Decline
- Hive-Engine Remove The Limit
- Secure Ten Year Old Smart Phone
- Share Your Cryptocurrency Node for $23
- Bitcoincash Supporting Wallets
- Celebrating Fathers day