Repository & Pull Requests
What is KnackSteem?
Knacksteem is an open source platform on the Steem blockchain that seeks to reward talents on a much broader scale, which eradicates partiality, and infuses transparency, on the blockchain. The initial goal of Steemit, which was to reward quality content was defeated in the sense that, creators of absolutely great content weren't recognized, and really cool talents were ignored. This major problem was the bane that stirred up the idea, creation, and finally, the development of Knacksteem. Talents and skills would never go unrecognized and unrewarded. The organization of Knacksteem makes this possible.
High-level details of the work done
In this pull request, I completed the integration of a delegators' tokens distribution bot and a curation bot which includes voting based in a given weight, commenting, and assignation of the corresponding knack tokens per contribution.
The delegators' tokens distribution bot is scheduled to run every day at 12PM server time. In order to avoid missing a delegator, before the tokens distribution, the delegators are sync with our database to ensure that we have a user created for the delegator.
The formula used to determine daily rewards for delegators is given as the following:
(delegated amount * max daily rewards) / total delegated to knacksteem
For example, I am delegating 2,577.818 Steem, Knacksteem has 6,444.486 Steem delegated, and the max rewards per day is 100,000. Thus, I should receive the following daily amount (only if total delegation does not change):
(2,577.818 * 100000) / 6,444.486 = 40000.3678863609 KNT
On the other hand, the curation bot is scheduled based on the remaining time to reach 100% voting power. When the server first run, the curation bot is triggered. If the voting power is not 100%, it will calculate how long it will take to reach 100% and will schedule the next run for the given time. If the voting power is 100% but the queue is empty, the voting round is postponed to one hour later and so forth until there are posts into the queue.
Before taking action in a post, the usage is calculated and we determine if this action will lower our voting power below 80.0%. If so, the voting round is postponed until voting power is 100% again.
Voting power recharges at a rate of 20% per 24 hours. So, from 0% to 100% it will take exactly 5 days to reach full capacity. 5 days is equivalent to 432000 seconds. Given this data, to determine fill rate per hour, we just need to drop 2 zeros from the 5 days in seconds time. Thus, voting power recharges 1% every 4320 seconds which is 1.2 hours. If we reverse back, 1.2 * 20 gives 24 which is the actual hours to reach 20%.
Given the explanation above, we can say that the following formula will give the remaining time to refill voting power in seconds:
((100 - currentVp) * 4320)
Another way to calculate the remaining time is by taking percentages in hours. To reach 100% from 0% it takes 5 days which is 120 hours. If our current voting power is 95%, we just need to take the 95% of 120 and subtract it from 120. For example:
95% of 120 is 114.
120 - 114 = 6 hours to reach 100%
which gives the following formula:
120 - (N% of 120) = remaining time in hours
If we compare both formulas, they yield to the same results:
120 - (95% of 120) = 6hrs
((100 - 95) * 4320) = 21600s = 6hrs
In brief, here are the steps that the curation bot takes:
- Check voting power
- If 100%, query pending post queue, else calculate remaining time and re-schedule
- Vote post
- Comment post
- Distribute KNT tokens to the user
- Delete post from the queue
- Calculate next curation round and re-schedule
And the delegators' tokens distribution bot takes the following step:
- Sync delegators
- Convert from vesting shares to Steem
- Calculate total delegations to KnackSteem
- Calculate rewards
- Give rewards to delegators
Want to learn more about KnackSteem?
Visit the following posts:
Feel free to join our channel https://discord.gg/t5RhBvE and we can show some of the pending tasks we have :)
Any question regarding implementation?
Feel free to ask me any question in the channel mentioned above or in the comments and I will try my best to answer them all.