Skip to content

Instantly share code, notes, and snippets.

@pgerbes1
Last active October 1, 2019 18:38
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save pgerbes1/8c0bdfc70055786cec43b885af5b249f to your computer and use it in GitHub Desktop.
Save pgerbes1/8c0bdfc70055786cec43b885af5b249f to your computer and use it in GitHub Desktop.

Payout Formula

paymentModelFunction = function(gbHours, downloadedBytes) {
  
  HOURS_IN_MONTH = (24 * 365) / 12
  ## Average number of hours in a month
  
  STORJ_USD_RATE = 0.81671
  
  ## This is determined by value reported on https://coinmarketcap.com/ at time 
  ## of payout calculation. 
  
  gbHoursScaled =  sapply((gbHours - median(gbHours)) / sd(gbHours), 
                          function(x) ifelse(x < 0, 0, x))
  downloadedBytesScaled = sapply((downloadedBytes - median(downloadedBytes)) / sd(downloadedBytes),
                                 function(x) ifelse(x < 0, 0, x))
  ## Both gbHoursScaled and downloadedBytesScaled can not be less than 0 to 
  ## ensure everyone gets at least the base payout amount. 
  
  downloadedBytesFlag = as.numeric(downloadedBytes > 0)
  gbHoursFlag = as.numeric(gbHours >= 730)
  isQualifiedFlag = sapply(gbHoursFlag + downloadedBytesFlag,
                           function(x) ifelse(x > 0, 1, 0))
  ## At least one of the above criteria must be met to qualify for a payment. 
  
  basePayout = (1.50 / STORJ_USD_RATE) * isQualifiedFlag
  ## The current base payout is set to $1.50 USD.
  
  ghHourPayout = 11.45 * gbHoursScaled * isQualifiedFlag
  downloadedBytesPayout = 3.0060 * downloadedBytesScaled * isQualifiedFlag
  
  payoutAmountSTORJ = ghHourPayout + downloadedBytesPayout + basePayout
  
  payoutAmountUsd = payoutAmountSTORJ * STORJ_USD_RATE
  
  cbind(payoutAmountSTORJ, payoutAmountUsd)
}


Details

  • Nodes that have not been seen in the past week (from the time first preliminary payouts are calculated) are not included in the metric totals
  • Each component (gbHours and downloaded bytes) is scaled so that each metric ends up being a measurement of how far away you are from the median
  • Those values are multiplied by certain weights and summed to arrive at a final value
@ccario83
Copy link

ccario83 commented Oct 1, 2019

Why define HOURS_IN_MONTH = (24 * 365) / 12 if 730 is going to be hard coded later on? Also, won't months with different number of days have the different GB requirement thresholds when holding time fixed at 100% per month? This seems arbitrary: 31 days >= 0.98 GB; 30 days >= 1.01 GB; 29 days >= 1.05 GB (and using 364.2422 doesn't make a difference). Hosting about a GB per month should be easy to do, but I don't quite understand why payout was calculated this way. It's quite unfair to February!

Anyway, I'm late to the game, so I'm sure the payout algorithm is quite different today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment