steembottracker.com - Improvement curation calculator (Merged)

jga(68)
Published in
#utopian-io
Words
652
Reading
3 min
Listen
Play
8y

ext4147.png

Steembottracker.com (by yabapmatt@yabapmatt) has a wonderful tool where we can calculate the curation rewards. This tool shows us how much we will receive if we already voted a post or if we are attempting to vote right now. Additionally, it includes a slider to define hypothetical post payouts, which also influences the curation rewards.

The heart of this calcultor is the following formula:

formula

where P0 is the payout before you vote, P1 is the payout after you vote, v is the value of the vote, PT is the payout after 7 days, and t is a value between 0 and 1 in function to the rule of 30 minutes.

Problem

This formula works very well in most cases, however, it is not perfect, it has 3 problems that I describe below:

  • Downvotes (flags): When a post is downvoted the total payout is decreased and the previous formula is broken (because it is designed only for upvotes). For instance, in this post grumpycat@grumpycat downvotes haejin@haejin. The calculator shows a negative curation, and it should be zero.

Screenshot_48.jpg

  • Re-upvoting: Steem blockchain has a special rule. When a curator unvotes and votes again he loses the curation rewards, and all this money is distributed among the other curators. For instance, in this post utopian-io@utopian-io gives a generous upvote, but he received nothing as curation. Why? because he unvoted and voted again.

Screenshot_57.jpg

steembottracker-error-rewards.jpg

  • The square root that the Steem Blockchain uses is an approximation of the real square root (details here). It uses a simple bit to bit operations which reduces a lot the computation and improves the transaction speed. The error of this approximation can go from 0% to 6%, as crokkon@crokkon detailed in this post.

Solution

Formula

The best way to calculate the curation rewards is following the same steps that the blockchain uses. Every vote contributes with an amount of r-shares (shares in the reward pool), and the total payout represents the STEEM reserved for the sum of all r-shares of the votes (including negative votes).

Let rsi be the r-shares of the vote i, and RSi the sum of all r-shares until the vote i. The weight curation contribution is determined by:

w

where f(x) is the approximated square root used in Steem. Additionally, if the curator votes within the first 30 minutes of publication part of his earnings go to the author and it is proportional to the remaining time to complete the 30 minutes.

25% of the total payout goes to curators. Each curator receives a percentage of this amount regarding his contribution with respect all curation contributions:

pcurator

where PT is the total payout, wk is the weight curation contribution of the curator, and t is a value between 0 and 1 that represents the rule of 30 minutes.

Then, the above formula is the correct calculation for each curation, and the one I have implemented in the code

(Note that if we assume that there are no downvotes or changes on votes, and that f(x) is the exact square root, then we get the formula shown at the beginning of the post).

Square root

As I mentioned before, the root square used in the Steem Blockchain uses simple bit to bit operations to approximate it. These operations are: OR, AND, SWIFTLEFT, and SWIFTRIGHT. However, it is based on 64-bit numbers and JavaScript only supports bit operations on 32-bit numbers.

For this reason, I coded a set of functions for bit operations on 64-bit numbers in order to implement the same square root used in Steem.

Code

The pull request of this new code was accepted and merged by the owner yabapmatt@yabapmatt.

NameLink
Github repositoryhttps://github.com/MattyIce/bottracker
Commit9077ef6aef39359dc02b2166adf7a4663ddb42ed
Pull Request and Mergehttps://github.com/MattyIce/bottracker/pull/35
Webhttps://steembottracker.com/curation_calculator.html

References

steembottracker.com - Improvement curation calculator (Merged) | Ecency