Heya everyone,
thank you very much esp. Meni Rosenfeld for explaining the PPLNS method in great detail. Maybe someone here can shed a bit of light to a little detail:
I am trying to implement the scheme and therefor have consulted this thread and re-read it numerous times.
Also I have studied the source code of some open source pools. I am pretty much sure to have understood it, but have found different implementations, and am in doubt especially about to how to understand the boundary conditions.
My main question still is - how to treat the "last" (oldest) share - meaning the one which brings the Totalscore > X.
a) let r become negative and include this share into the payment.
b) stop 1 share before - at the "last" share where Totalscore <= X.
After studying a lot I came to the following conclusion (method b) and would like to sum up and show how my understanding is, in one post so to say. It maybe help others, and would like to ask for comments if everything is correct.
Therefor I prepared an example with 10 shares, and easy to calculate numbers.
The following mini spreadsheet visualizes what I mean:
https://pasteboard.co/IlbdR2U.pngBoiling everything down, it looks like a very simple pseudo code:
0. TotalScore = 0, X = 2, B = Block.Reward
1. Calculate score of Winning share:
s = Share Diff / NW Diff and remember as t
2. Do WHILE TotalScore < X
s = share.Difficulty / network.Difficulty
TotalScore += s
r = X - TotalScore
Payout = (s * B) / (t * X) * min(r, t)
TotalPayout += Payout
share.Next()
What do you say - is that a correct PPLNS implementation?
Thank you very much!
Randominer