TeamEmpireCoin / EmpireCoin

EmpireCoin is an experimental cryptocurrency where players vote on outcomes to win coins
http://empirecoin.org
MIT License
2 stars 2 forks source link

Determine difficulty by both POW and POS #29

Open joeyfrich opened 8 years ago

joeyfrich commented 8 years ago

Currently EmpireCoin uses the same difficulty function as bitcoin to validate blocks. But because of voting payouts, there is an incentive problem where miners exclude everyone else's votes and selfish mine all blocks in a round to keep all voting payouts for themselves. To alleviate this problem, EmpireCoin needs to reward miners for including votes in their block. This can be accomplished by reducing the POW required based on the number of votes included in the potential block. A difficulty scoring function like this can be used:

difficultyScore(potential_block)
  pow_score = bitcoinDifficulty(potential_block)
  possible_votes = totalCoinsInExistence()
  pos_fraction = votesInBlock(potential_block)/possible_votes
  pos_factor = 1+(10*pos_fraction)
  return pow_score*pos_factor

In the code above, pos_fraction is a number ranging from 0 to 1 corresponding to the percentage of votes included in the block compared to the total possible votes (aka the total coins in existence). Therefore pos_factor can have a value between 1 (if no votes are included in the block) and 11 (if every coin in existence is included in a voting transaction in the block).

Recall that each coin can be voted once in a voting round (10 blocks). Assuming everyone acts in their best interest by voting all of their coins once per round, we would expect blocks to have an average pos_fraction of 0.10, leading to an average pos_factor of 2. A block which includes no votes would therefore have a pos_factor of 1, requiring a proof of work twice as difficult to solve a block.