%
%
% Proof of Work Probability Calculation
% HNLee Lecture, Blockchain1.pdf, page 76
%
% The input set C is divided into two sets
a = 2^10; % good set size
c = 2^32;
N =1e5; % pool size
% Probability that a cpu gives a good block summary in a single cycle.
p1=a/c;
q1=1-p1;
% This cpu runs 100 hashcycles per second.
% Probability that this cpu finds a good block summary in 100 hash cycles.
util=0:1:99;
Q1=q1.^util;
Q1=p1*Q1;
p2 = sum(Q1)
% Suppose there are N = 10,000 such cpu's working independently and
% simultaneously. What is the probability that this pool can find a good
% block summary? That is at least one computer finds a good summary.
%
p3 = 1-(1-p2)^N