Bitcoin Forum
July 16, 2024, 03:08:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: I don't understand how N in PPLNS is calculated  (Read 287 times)
CherryDT (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
October 20, 2017, 10:17:21 AM
Last edit: October 20, 2017, 10:54:40 AM by CherryDT
 #1

Hello,

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.

Thanks,
CherryDT
popolite11
Sr. Member
****
Offline Offline

Activity: 882
Merit: 250



View Profile
October 25, 2017, 01:59:29 PM
 #2

The calculation is made after finding a new block; the contribution of each miner in % is estimated. The miner contribution and his previous merits are also estimated. This method is resistant to pool hopping; shares can be considered several times.
CherryDT (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
October 25, 2017, 04:56:35 PM
 #3

This does not answer my question.

In fact, in the meantime, I found the solution myself (in case anybody else is interested): For Scrypt coins (not for SHA-256 or X11), the difficulty values used in miner softwares and pools (but not the coin difficulty itself!) are scaled by a factor of 65536 (2^16). Divide the difficulties by that factor if you want to compare them to the block difficulty. Then suddenly everything falls in place again.

Or, said in another way: A share with difficulty 1 is actually difficulty 2^(-16). So you need 65536 more shares than you think in order to find a block (on average, of course).

I posted the full explanation here: https://bitcoin.stackexchange.com/a/61166/62320
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!