The Mathematics of Bitcoin