How to build a bitcoin miner from scratch