Skip to content

StevenBlack/hackfest

Repository files navigation

Hackfest 2023

These are notes from my Hackfest 2023 presentation on Friday October 13 2023 in Lévis, Québec.

The topic is presented in French. The title of the presentaton is "Bitcoin: Cool et pas à peu près" which is colloquial French for Bitcoin is pretty cool.

The session's aim is to explain Bitcoin while highlighting some of its cooler technical facets. In 45 minutes or less.

Session outline

  1. Introduction
  2. Epistemology of Bitcoin (some high level conclusions)
  3. BTC, satoshis, and unit bias
  4. Hashing, blocks, proof of work, and mining
  5. Bitcoin's heartbeat: Block time, mining difficulty, and mining difficulty adjustments
  6. Halving and issuance

Introduction

Here I extemporaneously explain who I am, why I'm here, and what I'm going to cover. You had to be there.

Epistemology of Bitcoin (some high level conclusions)

Why is explaining Bitcoin hard? Understanding Bitcoin certainly has a learning curve.

It's like understanding Bitcoin requires an activation energy, with an elevated cognitive "hump" that dissuades many people from fully understanding it initially.

It's like an endothermic reaction in chemistry, with its energy hump to overcome before the reaction can proceed.

Activation energy

Bitcoin is a broad subject composed of several orthogonal facets. Explaining Bitcoin involves explaining disparate things that are related, but not correlated. It's hard to know where to start. An obvious linear and logical narrative doesn't appear to exist. I always seem to be repeatedly circling back to introduce new primitive concepts.

Explaining Bitcoin sometimes feels like a Tarantino movie, where the story is told in a non-linear fashion.

alt text alt text

There has to be a logical and systematic way to explain Bitcoin.

Analyzing Bitcoin subject matter

Here we try to picture and resolve why Bitcoin is so hard to explain. We start by picking 21 facets to be explained. We could have picked 40 facets, but 21 is ample for now.

If we list Bitcoin's salient subjects, and cross-reference among them for prerequisite relationships, we get a table that looks like this.

Base concepts and their prereqisite relationships

All matrices can be represented as a graph network. Here's the graph network of these prerequisite relationships. What a mess! Let's try to make sense of this.

Base concepts and their prereqisite relationships

Let's see a layered graph layout to visualize the subject prerequisite relationships. This is a little better, but it's still a mess.

Layered format for the network graph

We can analyze the network graph for cliques. This is interesting because it shows how some concepts are more tightly related. This seems to be is a promising starting point for segmenting the subject matter.

Cliques in the network graph

What if we score subjects for their prerequisite value, their complexity (the number of prerequisites), and subtract the complexity score from the prerequisite value?

In other words, the strategy is to start with the subjects that have the highest prerequisite value, and the lowest complexity.

This gives us a pretty nice roadmap! The third column in this table leads with the simpler subjects that partially unlock the greatest number most complex subjects.

prerequisite value (P) complexity (C) P - C
alt text alt text alt text

So let's run in that order, and see how it goes.

BTC, satoshis, and unit bias

Bitcoin values are expressed in satoshis. 1 BTC is 100,000,000 satoshis. This is why we see at most 8 decimals in Bitcoin values.

8 decimals

Note that, when we express a monetary value denominated in BTC, we typically get a decimal value. Fun fact: this is the ONLY place in the Bitcoin universe where we see a real number, or a decimal of any sort. Bitcoin world is all about integer values only.

8 decimals

You may have heard something to the effect that "Bitcoin is at the leading edge of mathematics, cryptography, and computer science". This is a little bit of an overstatement.

For example, here are some math symbols you won't see in Bitcoin:

≈   𝝅   ℯ   i   √   ∂x/∂t   ∫   Σ   ∏   μ   σ   n!   ε   ∞   ÷

You also won't find any vectors and no matrices either. There are no angles, there is no trigonometry. There are no imaginary numbers. There are no negative numbers either. There are no fractions. There are no decimals and, therefore, no irrational numbers.

Bitcoin's math is actually accessible to anyone who has completed grade 8 math.

As for cryptography, nothing is encrypled in Bitcoin, so there's nothing to decrypt either. The cryptography primitives used by the Bitcoin network is all about hashing and digital signatures, which widely accessible subjects, and certainly not at all "at the leading edge of cryptography."

Hashing, blocks, proof of work, and mining

We explain the following concepts using Anders Brownworth's most excellent blockchain demo running locally.

  • hashing
  • blocks and blockchains
  • proof of work
  • mining

Anders Brownworth's blockchain demo

We also take a quick tour though mempool.space

alt text

SIDEBAR: How much mining is presently going on?

I don't plan on covering this diring the talk. I add this here because I think it's good to be familiar with all this.

According to Clark Moody's Bitcoin Dashboard, on October 8, 2023, there is 422 exahashes per second (EH/s) of mining activity on the Bitcoin network over the last 2016 bkocks.

Which means, miners are presently executing 422 * 10^18 hashes per second.

alt text alt text

Calculating the electrical power consumption of the Bitcoin network

A Bitmain Antminer S19 Pro (110 TH) mining rig is capable of 110 TH/s while consuming 3250 Watts of electrical power. Which means, presuming this rig is typical (it's close), there would be 3,800,000 of these rigs mining Bitcoin presently, consiming 12,350,000 Watts (12.4 GW) of electrical power.

In comparison, the LG-2 power generating station in Baie James is capable of generating 5,616 MW (5.6 GW) of electrical power. Which means, the Bitcoin network is presently consuming the equivalent of about 2.2 LG-2 power generating stations.

(from financial constraints)

See the caculations in file btc-energy-use.pdf

In short, global Bitcoin energy use is equivalent to 40-50% of the electrical power production of the province of Quebec.

alt text

Bitcoin's heartbeat: Block time, mining difficulty, and mining difficulty adjustments

The bitcoin network strives to generate a new block every 10 minutes. This is called the "block time".

The block time is controlled by the mining difficulty, which is adjusted every 2016 blocks in order to reset the block time to 10 minutes based on mining activity over the previous 2016 blocks.

alt text

alt text

Why is the bitcoin network over 35,000 blocks ahead of its target pace? Because resetting the mining difficulty adjusts the pace of production, but does not compensate for over and under production. Given the increasing hashrate trend (see below), the blockchain tends to become ahead of schedule.

alt text

Halving and issuance

Bitcoin issuance is controlled and limited by a systematic gradual reduction of the block reward. This is called the "halving", which occurs every 210,000 blocks.

The first block reward was 50 BTC, which is 5 billion satoshi. In 2016 the block reward was "halved" to 25 BTC, then 12.5 BTC in 2016, and 6.25 BTC in 2020.

How does "halving" ever get to zero? And didn't we say earlier that there are no division operations in bitcoin? Actually the block reward is not halved by division, but by bit shifting. The block reward is an integer value, and removing bits, one by one, is equivalent to dividing by 2 each time.

The value of 5 billion satochi — 50 BTC — is represented in binary as follows:

100101010000001011111001000000000

Every 210,000 blocks, one bit gets dropped from the right side of the binary value. This is equivalent to dividing by 2, wrapped in a floor() function so it rounds down when the dropped bit is 1.

Here is a table of the halving epochs, and the block reward in BTC and satoshi.

alt text

It's notable that the sum of all block rewards is just under 21 million BTC, !( 20,999,999.9769 BTC to be precise.)

alt text

Resources

These are links to things I referenced during the presentation.

About

Session notes for my Hackfest 2023 presentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published