Some stats that I gathered via the json interface:
Blocks: 20
Difficulty: 12252.03471156
Mean shares per block: 15978.65
Std. deviation: 11854.889675889019
Std. deviation of mean: 2650.8339181048295
p: 0.1597754530320632
These blocks were created with the old difficulty, so it is not yet updated here.
I was mainly interested in the relation between difficulty and mean shares/block, since ideally they should be equal. Of course, due to the small number of blocks, there will be differences. For the statistical significance of this difference, there is the probability p. Very small values such as 0.01 would indicate that something funny is going on, perhaps cheating.
Below is the code I used. The calculation of p is not very accurate, as I assumed a normal distribution. More realistically it should be the Poisson interval distribution, but I am not sure how to apply a z-test in that case. Nevertheless, this might be of interest to someone.
#!/usr/bin/env python
url = "http://mining.bitcoin.cz/stats/json/"
#from jsonrpc import ServiceProxy
#s = ServiceProxy("http://user:passwd@yourip:8332/")
#info = s.getinfo()
#diff = ["difficulty"]
diff = 12252.03471156
import urllib, json
def mean(l):
return sum(l) len(l)
def sigma(l):
m = mean(l)
return mean(map(lambda x: (x - m)**2, l))**0.5
import math
# from http://www.codeproject.com/KB/recipes/IronPython_normal_prob.aspx
def phi(x):
# constants
a1 = 0.254829592
a2 = -0.284496736
a3 = 1.421413741
a4 = -1.453152027
a5 = 1.061405429
p = 0.3275911
# Save the sign of x
sign = 1
if x < 0:
sign = -1
x = abs(x)/math.sqrt(2.0)
# A&S formula 7.1.26
t = 1.0/(1.0 + p*x)
y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*math.exp(-x*x)
return 0.5*(1.0 + sign*y)
data = urllib.urlopen(url).read()
blocks = json.loads(data)['blocks']
# floats are better for mean/sigma
shares = map(lambda x: float(blocks[x]['total_shares']), blocks.keys())
n = len(shares)
stddev = sigma(shares)
sm = stddev n**0.5
m = mean(shares)
# 2-sided z-test (normal distribution)
z = (diff - m) sm
p = 2*(1 - phi(abs(z)))
output = [["Blocks", n],
["Difficulty", diff],
["Mean shares per block", m],
["Std. deviation", stddev],
["Std. deviation of mean", sm],
["p", p],
]
width = max(map(lambda x: len(x[0]), output)) + 1
for i in output:
print(i[0] + ":" + " "*(width - len(i[0])) + `i[1]`)