Dummies guide to Bitcoin Energy Use

For past couple of months, there has been an increased focus on bitcoin energy usage. Recent examples are –  Vice article  and IEEE.

This post attempts to explain bitcoin’s energy usage. It also tries to add some perspective on the energy problem.

Warning: This article gets a bit technical.

Flow of Money

“It is digital money” is simplest explanation for bitcoin.

Digital currencies have an inherent problem. Let’s take an example. A digital currency called “MyDitigalCoin”:

mydoc_coin

If I need more MyDigitalCoin I can create a copy.

mydoc_coinmydoc_coin

Tada! I have 2 coins now. It is called double spending.

The solution is to record ownership information.

Owner How Many MyDigitalCoins?
Me 1

 

Ownership and amount can be verified using this record. You can now reject every “copy” coin. This record is called a ledger.

Banks use ledgers to store your ownership and spending. Banks secure and maintain the private ledgers. Government authorities act as monitoring authority for the banks.

A cryptocurrency’s ledger is open to everyone. Anyone can check and edit the ledger. Hence the name – “public ledger”.

Public ledgers have two issues:

  1. Editing the ledger requires a trusted party.
  2. The identity verification of the trusted party should be fast.

Enter….

Proof of Work

We discussed “proof of work” earlier on this blog here.

Proof of Work asks a miner to generate a token (nonce). The nonce verification happens in less than a second.

After verification, the miner can edit the ledger and earn reward coins.

But, there is a problem.

Latency and “Blockchains”

On the internet there is always a delay between action and reaction. This time delay is called latency.

In Bitcoin, it is the time difference between block creation(action) and acceptance by all peers(reaction). This process of a block being accepted by other peers is known as block propagation.

Because of this delay there are always multiple versions of a blockchain. Wikipedia entry on blockchain has a diagram:

blockchain

Green box is our genesis block. Black boxes are blocks accepted by the whole network. This chain of black blocks is called main chain.

Purple and black blocks are mined at the same time. Purple boxes are valid blocks but not accepted by the whole network. These are called orphan blocks.

This latency causes two problems.

First, we don’t know if an accepted transaction is in an orphan or main chain block. This can cause double spending.

Visually, think a transaction included in purple block #1 but not black block # 1. This can be due to latency or someone maliciously changing the structure. Whatever the case, coins from purple # 1 can be re-spent and included in black block #2.

Second, orphan and main blocks both require same mining effort. So, orphan block is essentially wasting computing resource. Additionally, the network needs to decide the valid block and build from there. This is called block reorganization. 

Think about the 2nd and 3rd purple block. That is a chain of two blocks. So, cryptocurrency network needs to work together and find if that chain is invalid.

As per this site, bitcoin’s:

  1. 95% transactions take 22 second
  2. 95% of blocks take ~13 seconds

There is a 13 seconds window where two different people can find a block. Combine it with the block generation time of 10 minutes, that is nearly 2% chance of an orphan block. This situation was even worse back in 2013. Block propagation was 125 seconds or 20% chance of an orphan block.

Confirmations and Maturity

The solution for transaction issue is to measure probability of double spending. All cryptocurrencies use the same metric – confirmations.

Once a transaction is included in a block, number of confirmation becomes 1. Probability of a block being an orphan grows smaller and smaller with each additional block added.

All crypotcurrencies have the “confirmations” section on the transaction page. Example bitcoin:

https://blockexplorer.com/tx/9491979b3e4fbab15f661a475b65d1c124cfa3495b60357eea8a66d5d763349c

transaction_confirmation

Here, the number of confirmations is 2. There is 1 additional blocks on top of the transaction block. So, the latest block number/lock time is 495750. Now, the block confirmations will be more than 1000 now.

Read More  Blockchain Usage Part 1

Block rewards, the newly minted coins, need 100 confirmations. This is known as block maturity. New coins can only be spend after maturing.

Revisiting Block Generation and Difficulty

Bitcoin’s solves block latency problem using block generation time and difficulty adjustment.

First, selecting a block generation time is a balancing act. This needs to be:

  1. High to delay blocks and minimize probability of an orphan block.
  2. Low to allow faster transactions.
  3. Low to allow faster confirmations. Confirmation counting starts from transaction block.

Bitcoin block generation time is 10 minutes. The recommended number of confirmations is 6 blocks. So, after an hour a bitcoin transaction is nearly immune from double spending.

Second, difficulty retargeting keeps the network within generation time boundary. Difficulty increases, if block generation is too fast. Mining becomes harder. Reverse is also true. Difficulty reduces, if blocks are taking too much time.

There is a simple relation between difficulty and PoW or hashing – Higher difficulty requires more hashes.

In Bitcoin, difficulty changes every 2 weeks. Additionally, it cannot change by more than 4 times the current difficulty.

Short History of Bitcoin Difficulty

When bitcoin started, the difficulty was 1. The first difficulty jump to 1.125 happened 11 months later in December 2009. As more people found bitcoin, the difficulty increased slowly.

A watershed moment happened when Laszlo Hanecz was able to find a way to mine coins using his GPU. Here’s the passage from Digital Gold by Nathaniel Popper:

Laszlo’s CPU had been winning, at most, one block of 50 Bitcoins each day, of the approximately 140 blocks that were released daily. Once Laszlo got his GPU card hooked in he began winning one or two blocks an hour, and occasionally more. On May 17 he won twenty-eight blocks; these wins gave him fourteen hundred new coins that day.

Satoshi knew someone would eventually spot this opportunity as Bitcoin became more successful and was not surprised when Laszlo e-mailed him about his project. But in responding to Laszlo, Satoshi was clearly torn. If one person was taking all the coins, there would be less of an incentive for new people to join in.

“I don’t mean to sound like a socialist,” Satoshi wrote back. “I don’t care if wealth is concentrated, but for now, we get more growth by giving that money to 100% of the people than giving it to 20%.”

As a result, Satoshi asked Laszlo to go easy with the “high powered hashing,” the term coined to refer to the process of plugging an input into a hash function and seeing what it spit out.

But Satoshi also recognized that having more computing power on the network made the network stronger as long as the people with the power, like Laszlo, wanted to see Bitcoin succeed.”

With people racing to find more blocks, difficulty increased steadily. In next four years, it went from just 1 to 3 million.

Many people were not interested in investing money the R&D money required for ASICs. But, in 2013 bitcoin prices touched $100 and suddenly there was interest in specialized bitcoin miners.

The miners started shipping towards end of 2013. While ASICs promised more efficient mining they came at a cost. The difficulty of bitcoin doubled in 2 months. This was truly “Tragedy of Commons“.

By the time 2013 ended difficulty increased by 1000 times to 1 giga hashes. Today, difficulty has increased by 1,500 times to 1.5 Terra hashes.

Energy usage

Now, let’s see the relationship between hashing and energy usage.

One of the famous bitcoin miners is Bitmain Antminer S9 Bitcoin Miner.

This machine can do 13.5 Terra Hashes per second (TH/s) or 13,500 Giga Hashes per second (GH/s). Here’s a table of coins at different difficulty levels:

Hashing Power (GH/s) Difficulty Bitcoins in 1 day
14000 1 3379583358.7646
14000 1000000000 3.3796
14000 1590896927258.079

(Current)

0.0021
14000 3181793854516.158 (twice the current difficulty) 0.0011

Let’s look at how the economics work:

Assume machine cost is 0.

This machine requires 1323 watts of electricity. In US, average cost of electricity is $0.12 kilo watts per hour. So, each day power cost is $3.81.

1 bitcoin goes for $13000. At 0.0021 BTC per day, revenue is $27.3/day.

Profit per day, after power costs, is $22.82.

That is ~$600 revenue per month.

This calculation is simplistic, especially with machine costs assumed to be zero. If people want, I will get into the economics of this.

Since starting of the year, difficulty has increased by more than 5 times. So, people mining 1 BTC in January can now only mine 0.2 BTC. Price have skyrocketed. People want to mine more coins.

Hence, people are adding more hashing power to bitcoin network. This has caused bitcoin’s energy usage to explode.

Bitcoin and the Energy concerns

The articles are right to an extent. If prices keep rising then surely people will spend more and more hashing power to earn coins. But, most of these discussions miss an important metric – mining efficiency. The metric for mining efficiency is watts required for 1 giga-hash. (1 giga-hash =1000000000 hashes)

Mining efficiency chart for the flagship Bitmain S-series miners:

bitcoin energy efficiency

The mining efficiency is up by 10 times in last 4 years.

The variability of mining profit comes mainly from electricity costs. With prices increasing (and lot of criticism on electricity usage) there will be even more research dedicated to reducing electricity costs. Sure, people might counterbalance this by trying to earn more coins. But, in time we will reach a balance. So, predicting a failure so soon is unwarranted.

There has been work on another Proof-model too.

Proof of Stake

This mining algorithm was first proposed on bitcointalk in 2011. The description given was (emphasis mine):

What I mean by proof of stake is that instead of your “vote” on the accepted transaction history being weighted by the share of computing resources you bring to the network, it’s weighted by the number of bitcoins you can prove you own, using your private keys.

So, instead of hashing and spending energy, a miner verification happens using coins owned by her. This proves her stake in the coin’s ecosystem. The idea being, if she has a stake then she will be less inclined to harm the coin. The first implementation of PoS happened in Peercoin.

There are couple of problems in PoS. First, someone can acquire coin just for creating issues. So, there is a coin age criterion. For staking considerations, coins need to be older than specific number of days. Example, peercoin considers coins not used, bought or sold, for last 30 days.

The second problem is “nothing at stake” problem. As we discussed above, due to latency, we have multiple blockchains at once. In PoW, computing acts as a deterrent to stop people from changing history.

In PoS, someone can stake their coins for more than blockchain. This can create a situation where there are multiple histories. So, blockchain reorganizes quite frequently.

To avoid this, PoS coins use a checkpoint system. On reaching a checkpoint, the blockchain freezes. There can be no changes beyond this checkpoint.

To understand this, look at the diagram in latency section. Let’s say the rule is – checkpoint after 4 blocks. So, after 4 blocks the first purple block is no longer valid.

The third problem is staking mechanism. Only people allowed to mine are the ones already owning coins. This makes the cryptocurrency somewhat centralized.

Conclusion

A decentralized currency where everyone can get in and have a fair say without consuming too many resources is a super interesting problem. Bitcoin is doing moderately well in this area. Mining efficiency research will lead the way for better energy future for bitcoin.


Also published on Medium.