Computing Request Costs
Last updated
Last updated
First, we’ll go over how the cost of a data request is determined from the values that a creator gets to configure. Namely, the values set for:
L - required lead
D - dispute period length
C - collateral (USD)
Once these values have been set, the rest of the values are computed. First, note that the collateral is only expressed in USD for ease of on-ramping. Thinking of value in terms of a cryptocurrency is foreign to most people since the majority of people still think in terms of a familiar fiat currency. Making request creation as accessible as possible for as many as possible was the goal. The first step in the process is to express the fiat value in terms of the coin native to the chain on which the ODO is deployed.
N - the collateral (C) expressed in the native coin
Once we know how much users are expected to stake, we can combine that value with the base pay rate to determine the amount that users must be paid for each datum they provide/endorse. The pay rate is computed as follows.
Dmin - the minimum possible dispute period length
Dmax - the maximum possible dispute period length
Pmin - the minimum possible pay percentage
Pmax - the maximum possible pay percentage
The equation might look complicated, but it’s actually rather straightforward. The term,
is just computing a percentage. For example, if the maximum a dispute period length can be (Dmax) is 8 hours and the minimum it can be (Dmin) is 4 hours, then intuitively, a dispute period length (D) of 6 hours is halfway or 50% or the way between Dmax and Dmin. The expected result of the expression is then 50%. Explicitly, the range in the denominator is 4 hours (Dmax - Dmin), and for a 6-hour dispute period length, the numerator becomes
(D - Dmin => 6 hours - 4 hours => 2 hours). Thus the expression becomes 2 hours / 4 hours = 50%. Just what was expected. So for this example we’re left with
With the percentage calculated, we can apply it to the pay range (Pmax - Pmin). Continuing with the example above, if the dispute period length is right in the middle, then the pay rate should be right in the middle. If the minimum pay rate (Pmin) is 1.5% and the maximum pay rate (Pmax) is 3.5%, then the percentage in the middle is 2.5%, so this is what we expect from the computation. Again, being explicit we have (Pmax - Pmin => 3.5% - 1.5% => 2%). Subbing that value into the equation for PayRate gives
which is exactly what would be expected. The technique is called linear interpolation, which is a fancy-sounding way of mapping one range to another so that traveling, for example, 10% of the way through one range maps to 10% through the other range. A choice of a dispute period length 20% of the way through the dispute period length range gives a pay rate that is 20% of the way through the pay rate range.
With the pay rate in hand, there are two steps remaining. The first step is to compute the fee that goes to the platform. This value is easy to compute from PayRate since it is a percentage of it multiplied by the collateral in the native currency. Currently this value is set to 5% of the PayRate, and it is the value that is paid in the first transaction that deploys the on-demand OD* contracts.
The cost for the rest of the transactions (the ones that actually contain the data requests) are similarly simple. The cost to send the transaction is the amount of data (summed across all datasets in the transaction) multiplied by the product of the pay rate and the collateral in the native currency.
So, the final total cost is
Finally, once the pay rate is computed, the real collateral value is determined so that the collateral and pay rate are properly related to one another.