Skip to content

Instantly share code, notes, and snippets.

@harding
Created February 22, 2024 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harding/3af02613d233554837f7921d7fd44e68 to your computer and use it in GitHub Desktop.
Save harding/3af02613d233554837f7921d7fd44e68 to your computer and use it in GitHub Desktop.
strategic_hr = 0.25
normal_hr = 0.005
normal_hr = 1 - strategic_hr
a = 1
b = 2
a_1 = 0.9
b_1 = 2.2
assert(a_1 < a)
assert( (a_1 + b_1) > (a + b ) )
######################
## Strategic payout ##
######################
# Finds two blocks in a row
strategic_payout = (strategic_hr ** 2) * (a_1 + b_1)
# Finds first block only
strategic_payout += ((1 - strategic_hr ) * strategic_hr) * a_1
# Finds second block only
strategic_payout += (strategic_hr * (1 - strategic_hr)) * b
# Finds neither block
# (no revenue change)
print("Strategic payout per hashrate: ", strategic_payout / strategic_hr)
###################
## Normal payout ##
###################
# Finds two blocks in a row
normal_payout = (normal_hr ** 2) * (a + b)
# Finds first block only
normal_payout += (normal_hr * (1 - normal_hr)) * a
# Finds second block only
normal_payout += ((1 - normal_hr ) * normal_hr) * b_1
# Finds neither block
# (no revenue change)
print("Normal payout per hashrate: ", normal_payout / normal_hr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment