Post
Topic
Board Altcoin Discussion
Re: Transparent mining, or What makes Nxt a 2nd generation currency
by
jettico
on 30/01/2014, 20:04:42 UTC
A bit more details:

Steps 3-5 in http://wiki.nxtcrypto.org/wiki/Transparent_Forging from the statistics point of view are equivalent to comparing random numbers uniformly distributed between 0 and 1/N where N is number of coins in the wallet (normalization coefficient is the same for all wallets and is omitted for clarity).

Now imagine that you throw a dice with numbers from 1 to 6 and your opponent throws a semi-dice with three possible values from 1 to 3. Who gets the lower number wins the round. In half of the cases you will throw 4-6 and win. In the other half you will have 50:50 chances to win. Thus your chances are 1/2 + 1/4 = 0.75 and his chances are 1/4 = 0.25. Which is 3 times lower.

For arbitrary ratio K between two wallets the probability ratio is 2K-1. For example, a wallet with 100k coins is 199 times more likely to forge a block than 1k wallet.

For three wallets the situation is even worse: if they have coins in the proportion of 100:1:1 the probability of forging a block is 298:1:1.

And here is the code that solves the issue:

Quote
from random import random
from math import log

NBLOCKS = 1000000
W1 = 1000
W2 = 100000

na = nb = 0.

for x in xrange(NBLOCKS):
    a = log(random())/log(1-1./W1)
    b = log(random())/log(1-1./W2)

    if a>b:
        na += 1
    elif a        nb += 1

print nb/na
99.9183570491