Lecture 5: Bitcoin mining

How to mine Bitcoin

  1. Download and run Bitcoin-core to run full Bitcoin node
  2. Listen for a new transaction, assemble a pre-block
  3. Solve the puzzle (~270 attempts)
  4. Broadcast the block
  5. Profit

The network runs on port 8333. Non-responding nodes are forgotten after 3 hours (5000-10000 nodes as of Sep 2016). Some seed nodes are hard-coded into the software. Zero transaction fee transactions were accepted until April 2012 before Satoshi Dice came around. Blocks are just an artifact of the mining process. Otherwise, it is just a stream of transactions. Changing the network layer is easy. Changing the protocol layer to add new opcodes is hard.

Types of mining

  1. CPU mining – 220 – 224 hash/sec => 246 seconds (4 million years) to mine a block
  2. GPU mining(2010-2011) – 227 hash/sec with a single card
  3. FPGA mining(2011-2012) – 230 hash/sec. FPGAs are not designed for continuous use though.
  4.  ASIC mining (late 2012-present) – 240 hash/sec for 100 USD (100 watt) for 16 nm feature size. 50% overclocking leads to 25% error => 12.5% more revenue!!!

70% of mining is in China due to the lower price.
Even with ASIC miner like Ant miner S9 which has 12 TH/sec (243 hash/sec), one has 66% chance of 0 blocks, 27% chance of 1 block, and 7% chance of 2 blocks in a year. Mining pool reduces this variance. The miners will show smaller work (240) regularly to prove that they are working.