Blocksim Monte Carlo simulation
Stefan Mangold, Lovefield Wireless GmbH. www.lovefield.ch
Blocksim is primarily used for educational purposes and maintained by Lovefield Wireless.
This GNU Octave (Matlab) code relates to cryptocurrency "mining" using proof of stake. There are n balls in a basket. Let's say n = 100 or 1000 or some larger number. We start with an initial allocation, so n people each have their own allocation of balls. Could be that one person has 60 of them. The allocation is given - it could be anything. It could be random.
Now each day we have a cash prize. We stir the basket and pull a ball out and we give the prize to whoever owns that ball. The question is: over time, will the distribution of returns favor people who start with the largest percentage and disfavor those with only one ball? Is it path dependent?
Is the answer no, because each ball represents a 1% chance to win, and if you have 60 balls you have a 60% chance to win 60% of the prizes forever?
In a second installment, the prize is not cash, it's one ball. When you win, you win a ball, and each day that new ball gets added to the basket. Balls have market value. For the purposes of this question, I don't think it matters whether the value goes up or down.
Assuming people always keep their winning balls and never sell them, and they always keep them in the basket to win more balls, now is it path dependent? In other words, over a large number of iterations, will whoever started with the largest number of balls eventually:
- a) keep his relative percentage of balls.
- b) the percentage of balls will fluctuate around the initial condition.
- c) the initially larger allocations will grow but will result in an oligopoly - a few large positions.
- d) the initial largest position, if it's large enough to survive the first few rounds as the largest, will always take over the entire pool, so that the others have vanishingly small percentages.
- e) several larger positions vie for supremacy in the early rounds, one finally wins, and that one goes on to own 99% of the balls.
- f) something else.