1
while my example in the following question is using the altcoin "Bitconnect", I believe it is actually a general question which fits here - if not, let me know.
I am struggling to understand PPLNS (I need to implement it in a pool). I know in general how the system works, but what is a mystery to me is where the N comes from.
I read on many places on the Internet that N = 2 * difficulty is a good value, and that this would mean that on average a miner will earn rewards from two blocks for the same shares.
However, it simply does not add up for me.
Practical example: BitConnect pool. Let's say BitConnect's difficulty is currently ~900,000.
An AntMiner L3+ submits a share at difficulty ~150,000 (which counts as a share value of 150,000 then) every ~15 seconds, so in 3 minutes, that one AntMiner has already filled the whole "N" of 900,000x2=1,800,000. That would, in reverse, mean that I would expect to mine a BitConnect block every 90 seconds on average, with one AntMiner, which is of course not true.
100 AntMiners running on our pool gave a share value of 230,000,000 in the last 5 minutes, which would have been more than 100 times the whole "N" already!
So something can't be right here, and I don't understand what. Should I not multiply the submitted share with the work difficulty? But then a small miner would get the same reward as a large one which makes no sense. Or is the whole Internet wrong about the 2*diff for "N", and that it's based on the assumption that it takes on average a value of shares equal to the difficulty to find a block? Doesn't sound likely.
On average, it takes 2^32 hashes to find a valid share at difficulty 1, right? And on average, it takes X shares to find a share at difficulty X, hence why you increase the difficulty at the pool for your miner if the miner is powerful (it will then less often submit a share), right...? But the last point starts to make less sense already, together with the fact that you need a share at difficulty Y to find a block if the currently coin block difficutly is Y... And the pool software counts a share with difficulty X the same as X shares with difficulty 1. At the end I'm left confused how it all works together and how I can arrive at a value for "N" which actually results in a miner getting on average two rewards for the same share...!
Please help me understand what is wrong.
EDIT: I found that all calculations differ from reality by a factor of 2^16. Then I found this: https://bitcoin.stackexchange.com/a/11816/62320 This would suggest that for Scrypt, pools use a scaled "share difficulty" value by exactly that factor, but the reported block difficulty would not be scaled. This would explain everything but it's the only place I found this on the Internet (and it would mean that I need different calculations depending on the algorithm I'm handling) - can anyone confirm this?
But that is only to compensate for network difficulty changing over tone, isn't it? And of course the answer your mention is based on bare shares with difficulty 1, so in my case it would be 150000/900000, giving 0.17, how do you get to 2 in your answer? – CherryDT – 2017-10-21T18:00:04.390
And then how come the difficulty gets squared? This sounds strange. I mean, saying that a diff 1 gives 1/900k, and the N is still 2x900k, meaning that you need 2x(900k^2) diff 1 shares - doesn't that square there feel a bit out of place? – CherryDT – 2017-10-21T18:01:57.370
What makes you think my answer is based on shares with a difficulty of 1? At no point in the post I linked to is difficulty of 1 suggested or mentioned. The squared is for variance (the statistical term), which is the square of standard deviation. Variance is not part of the calculation that you want to look at. – Andrew Chow – 2017-10-21T18:14:00.520
I meant that the forum post you linked is using the term "share" as "share diff 1". A share with a higher difficulty must have an equally higher value... – CherryDT – 2017-10-21T19:19:39.733
In fact, after doing various calculations, it seems everything is off from reality by a factor of 2^16, as if N2^16 (instead of N2^32) hashes would give you a share with difficulty N... I don't understand yet why, though – CherryDT – 2017-10-21T19:21:13.423
I found this now: https://bitcoin.stackexchange.com/a/11816/62320 - does this mean that pools show a scaled difficulty value for Scrypt, but for other algorithms it's different, and the block difficulty is confusingly not scaled?
– CherryDT – 2017-10-21T19:32:12.970@CherryDT: The linked post does assume that share difficulty is 1, but that is easy to fix - instead of assigning a score of 1/D, you assign a score of d/D where d is the share difficulty. I'm not completely sure I understood the rest of your questions, but I highly recommend you read https://bitcoil.co.il/pool_analysis.pdf before starting to implement reward methods. It should either answer your questions or give you the background to ask more focused ones.
– Meni Rosenfeld – 2017-10-23T10:23:43.640@MeniRosenfeld: Yes, true, that's what I meant in my example in my comment above. The rest of my questions is already answered by myself, see the other answer in this thread. Thanks for your link, though! – CherryDT – 2017-10-23T14:45:05.310