Optimized Decentralized Reward Distribution(1)
Abstract
Chun-Hu Cui and He-Song Cui
In DeFi (Decentralized Finance) applications, and in dApps (Decentralized Application) generally, it is common to periodically pay interest to users as an incentive, or periodically collect a penalty from them as a deterrent. If we view the penalty as a negative reward, both the interest and penalty problems come down to the problem of distributing rewards. Reward distribution is quite accomplishable in financial management where general computers are used, but on a blockchain, where computational resources are inherently expensive and the amount of computation per transaction is absolutely limited with a predefined, uniform quota, not only do the system administrators have to pay heavy gas fees if they handle rewards of many users one by one, but the transaction may also be terminated on the way. The computational quota makes it impossible to guarantee processing an unknown number of users. We propose novel algorithms that solve Simple Interest, Simple Burn, Compound Interest, and Compound Burn tasks, which are typical components of DeFi applications. If we put numerical errors aside, these algorithms realize accurate distribution of rewards to an unknown number of users with no approximation, while adhering to the computational quota per transaction. For those who might already be using similar algorithms, we prove the algorithms rigorously so that they can be transparently presented to users. We also introduce reusable concepts and notations in decentralized reasoning, and demonstrate how they can be efficiently used. We demonstrate, through simulated tests spanning over 128 simulated years, that the numerical errors do not grow to a dangerous level.