Created: 2011-07-18 12:57
Updated: 2013-11-12 22:26


Pool Payout Simulator

Running the simulation

ruby test.rb

Changing the parameters

You can pass the following options to the run or new methods:

  • :rounds: number of rounds to run (default: 100)
  • :difficulty: difficulty level, in mean shares per block (default: 1,500,000)
  • :miner_percent: percentage of total hashrate owned by target miner (default: 2)
  • :average_fees: mean amount of fees, in BTC (default: 0)
  • :withholding_percent: percentage of pool that will withhold a found block (default: 0)
  • :hopper_percent: percentage of base pool size that joins for the first part of the round (defualt: 0)
  • :hop_out_at: percentage of difficulty at which hoppers jump out (default: 43.5)

Available payout models

  • Prop: Straight proportional payout
  • SMPPS: Luke-Jr's Shared-Maximum Pay-per-Share
  • XPPS: Like SMPPS, but without debt memory

Estimating Results

If you want to know the average outcome after the simulation ends, simply pass an initialized simulation object to Estimator.new, and call run. To see the results, then call analyze:

Estimator.new(Prop.new, :runs => 1000).run.analyze

Any options besides :runs passed to new or run will be passed on to the simulation object's run method.

Writing your own model

To create your own payout scheme, subclass PoolSim and implement the pay_out method. This method should, at a minimum, update the @honest_earnings variable, which represents the cumulative earnings of a single miner owning miner_percent% of the pool hashrate.

If you have other variables you want to plot other than the defaults (Round, Reward, Shares, and Difficulty), you can declare them with

class CustomPool < PoolSim
  plot :myvar1, :myvar2
  def pay_out
    @miner_earnings += ...

Other useful stuff

The Tabulator class can print pretty tables for you:

headers = [:name, :age, :occupation]
bob = ['mario', 54, 'Plumber']
john = ['John Smith', 216, 'Philatelist']
Tabulator.new([bob, john], :headers => headers).render_columns

would render like this:

Name       | Age | Occupation 
mario      | 54  | Plumber    
John Smith | 216 | Philatelist


  • Parameter sweeping
  • Graphs
  • Hashrate profiles
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more