This is the archived Spring 2015 version of the course. For the most recent version, see

Class 10: More Mining

Posted: Mon 16 February 2015


  • Project 2, Part 1 is due Sunday, 22 February. Part 2 will begin afte class on Monday, 23 February and is due on Thursday, 5 March.

  • Start (continue!) thinking of ideas for your final project. I've posted a few starting ideas on the course site. The first major deliverable for the final project will be a project proposal (due 20 March)

  • Reading: finish reading through Chapter 8: Mining and Consensus.

Note: due to a bug in slideshare's updated player, ink markings no longer appear in the viewer.
If you download the slides, they are present though. Hopefully, the player will be fixed someday.

Final Project

Your main assignment after finishing Project 2 will be an open-ended project. You can work on anything you want that is related to cryptocurrency (loosely defined), so long as you can convince me it will be interesting and worthwhile. My hope is everyone will do a project that will have significant value beyond just our class.

You can work alone or in a team of any size. The impressiveness of your project should scale with the size of your team (but not linearly, since there is added communication overhead as your team size increases). It should scale as at least N2/3 where N is the number of students in the course on your team. (You are welcome to enlist help from people not in the class, and they don't count towards your N value.)

Forking PointCoin

What causes a blockchain to fork?

If all the trans-pacific network cables (there are only about 12) were cut, what would happen to the bitcoin blockchain?

Asymptotic Analysis

When is asymptotic analysis useful?

When is asymptotic analysis useless?

The measured time to compute one SHA-256 hash on my EC2 node (2.5 GHz processor) is 750 ns. Approximately how many instructions execute to compute on SHA-256 hash?

Mining Cost

Assumption. SHA-256 produces a uniform random output. (We know this is not really true, but it is a reasonable approximation, and necessary for the analysis.) So, we can model SHA-256 on any (new) input x as drawing randomly from 2256 possible outputs:

      SHA-256(x) ← [0, 2256)

Target = Tmax / Difficulty
Tmax = (216 – 1)2256 ≈ 2224

Current (15 Feb) Bitcoin Difficulty = 44,455,415,962

>>> target = 2 ** 224 / 44455415962
>>> success_probability = target / 2**256
>>> expected_hashes = 1 / success_probability
>>> nanos_needed = expected_hashes * 760
>>> seconds_needed = nanos_needed / 10**9
>>> days = seconds_needed / (60 * 60 * 24)
>>> years = days / 365
>>> years * 2
~ 9.2 M years to find one block on EC2 (assuming difficulty doesnt increase)


Why is energy/hash so much less for custom ASICs?

In an ASIC, it is possible to build an XOR using 4 transistors. How many transistors have to flip to do an XOR on a general purpose processor like an Intel i7?

Mining Hardware - current ASIC miners achive >5 Billion hashes per seconds and over 1500 Million hashes per Joule (the energy required to lift an apple one meter).

Inside a Chinese Bitcoin Mine, The Coinsman, 11 August 2014.

The first thing you notice as you approach the warehouse is the noise. It begins as soon as you step out of the car, at which point it sounds like massive swarm of angry bees droning away somewhere off in the distance. It becomes louder and louder the closer you get to the building, and as you step through the doors it becomes a deafening and steady roar...

Estimate for total energy use of bitcoin network with current hashrate:

>>> expected_hashes
>>> hashes_per_second = expected_hashes / 600
>>> 309384699.96 * 10**9 # according to 309,384,699.96 GH/s
>>> _ / hashes_per_second
>>> Mhash_per_J = 1500
>>> Mhash_per_second = hashes_per_second / 10**6
>>> J = Mhash_per_second / Mhash_per_J

212 MJ per second = 212 MW

Our nearest nuclear plant, the North Anna Power Station (Lake Anna) generates 1892 MW, "enough to power 450,000 homes" or about 9x the amount needed to power the current bitcoin network (only counting the miners themselves; additional power needed for cooling, etc.)

How does the energy use of bitcoin compare to what is used by the current financial infrastructure for comparable service? (This is a very difficult question to answer, would be a good project idea, not something to answer in the blank below!)