Demystifying Bitcoin Mining