Skip to content

Instantly share code, notes, and snippets.

@mkingori
Last active October 9, 2019 07:51
Show Gist options
  • Save mkingori/acfa0e5dda4fa9c5d7ca2719c796cf94 to your computer and use it in GitHub Desktop.
Save mkingori/acfa0e5dda4fa9c5d7ca2719c796cf94 to your computer and use it in GitHub Desktop.
PoW
===
External Hash Rate:
targetHashRate = hashrate / (1 - targetPow / 100)
Internal Hash Rate:
targetHashRate = hashrate * targetPow / 100
Device Cost in DRCs:
deviceCount = (targetHashRate * 1000) / deviceInfo.hashrate
Device cost in USD:
totalDeviceCost = deviceCount * deviceInfo.cost
Total kWh attack for 1 hour:
totalKwh = deviceCount * deviceInfo.power * attackPeriod / 1000
Total PoW attack:
totalElectricity = totalKwh * kwhRate
extraCostsRate = 1 + (otherCosts / 100)
totalPow = extraCostsRate * totalDeviceCost + totalElectricity
PoS
===
future ticket price:
DCRNeed = tpValue / 0.6
futureTicketPrice = DCRNeed / tpSize
Attack Tickets needed:
ticketAttackSize = (tpSize * targetPosTarget) / 100
ticketAttackSize = ticketAttackSize * this.targetPos / 100
Tickets value:
totalDCRPos = ticketAttackSize * futureTicketPrice
Total PoS attack cost:
totalPos = totalDCRPos * dcrPrice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment