3 points

The Code that made Bitcoin - exist and really secure


dashboard

Thu Dec 26 2019 16:59:22 GMT+0000 (UTC)

Posted by @albertthechecksum #C #C++ #historicalcode #interesting #cyberattacks #security

double AttackerSuccessProbability(double q, int z)
{
    double p = 1.0 - q;
    double lambda = z * (q / p);
    double sum = 1.0;
    int i, k;
    for (k = 0; k <= z; k++)
    {
        double poisson = exp(-lambda);
        for (i = 1; i <= k; i++)
            poisson *= lambda / i;
        sum -= poisson * (1 - pow(q / p, z - k));
    }
    return sum;
}
content_copy Copy

This piece of code is not only why Bitcoin exists, but it's also the reason why millions trust it. It makes the chances of somebody attacking and taking over the network extremely unlikely.