Recap

Protocol: How a transaction is put into the global ledger

  1. New transactions are broadcast to all nodes.
  2. Each node collects new transactions into a block.
  3. Each node works on finding a difficult proof-of-work for its block.
  4. When a node finds a proof-of-work, it broadcasts the block to all nodes.
  5. Nodes accept the block only if all transactions in it are valid and not already spent.
  6. Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Conflict Resolution

In the above protocol, the first miner to submit a valid block gets his block added to the blockchain and receives the reward.

Conflict

However, what happens if two miners or more submit their blocks at the same time?
If two miners solve a block at almost the same time, then we will have two different blockchains in the network.
  • Node A that finds the proof of work will contain a block chain that looks like the upper on in the picture.
  • Node B that finds another proof of work will contain a block chain that looks like the lower on in the picture.
  • The other nodes will be confused. They will hold both chains at the moment and wait until the conflict is resolved.

Resolving conflicts: choose the longest chain

We need to wait for the next block to resolve the conflict. Nodes always consider the longest chain to be the correct one and will keep working on extending it.
  • If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one block (or the other) first.
  • The nodes will work on the first block they received. (The other branch will also be stored in case it becomes longer.)
  • The tie will be broken when the next proof-of-work is found and one branch becomes longer. That is, the nodes that were working on the other branch will then switch to the longer one.

Conflict Resolution: Security Consideration

As you just saw, when there is a conflict, the longer branch will be accepted. This has important security implications.

Even if a transaction is put into the block chain, don't relax yet! It is possible that your branch may be nullified in the midst of conflict resolution procedures.

Finney Attack

Consider a merchant who accept a payment immediately on seeing the transaction written into the global ledger.





Unfortunately, the merchant is exposed to the transaction being reversed. An attacker can pre-mine a block with a transaction, and spends the same coin (i.e., double spending!) in a second transaction before releasing the block.

In particular, a Finney attack works as follows (see the picture on the right):

Source: Steemit.com

Confirmation

As you see from the Finney attack, acceptance of a block may be temporary. Even if we see that a recent transaction is already included in the blockchain, there is no guarantee that this chain is the "permanent" one, since it is possible that another branch may grow longer than the one that has already accepted by a node. If the new branch doesn't not include this transaction, the transaction is invalid.

The question is:

When should we feel confident that our transaction is "permanently" accepted?

Confirmation number

One good indicator is how many blocks are added to the blockchain after a transaction is included. We call this confirmation number.

Mining Speed: Honest Nodes vs Malicious Node

The key issue: the longest chain

Recall that the longest chain is the "permanent" one. If an attacker can mine faster than all the honest node together, then the attacker will be successfully in the double spending.

Hash power

In the bitcoin system, the primary task of mining is to calculate hashes in order to find a valid block. Therefore, the mining speed can be essentially measured using hash rate, which measures how many operations a miner can do per second. Hash rate is also called hash power. The higher a miner's hash power is, the more likely that the minder can do double spending.

In 2012, Rosenfeld calculated the probably of a successful double spend, with regard to the hash rate and confirmation number.

51% attack

A 51% attack occurs when one or more miners takes control of more than 50% of a network's hash power. If a 51% attack is successful, the attacker essentially controls the network. Something like this has actually happened before.

Other Things about Bitcoin

Reward to the miner

When a miner creates a block, the miner creates coins as a reward (along with the transaction fee).

The Bitcoin scalability issues

The on-chain transaction processing capacity of the bitcoin network is limited by the average block creation time of 10 minutes and the original block size limit of 1 megabyte. These jointly constrain the network's throughput. The transaction processing capacity maximum estimated using an average or median transaction size is between 3.3 and 7 transactions per second.

There are various proposed and activated solutions to address this issue. See here for more details.

Energy consumption

Bitcoin has been criticized for the amount of electricity consumed by mining -- so many hash calculations!

Source: cbeci.org.

Bitcoin’s electricity consumption is roughly 130 TWh, which is above total energy consumption in Argentina (121 TWh), the Netherlands (108.8 TWh) and the United Arab Emirates (113.20 TWh).

Bitcoin explorer

Check out this site.

True or False?

  1. (T/F) Conflicts happen when a block has multiple parent blocks.
  2. (T/F) The higher confirmation number a transaction has, the safer it is.
  3. (T/F) Even if a block is mined with a proof of work, the block can be nullified.
  4. (T/F) The security of the block chain depends on the assumption that the aggregate hash power of the honest miners is greater than that of the attacker.
  5. (T/F) The only source of the reward for the miner is from minting coins.
  6. (T/F) The number of all minable coins are upper bounded by a fixed number. There should exist no more coins than that many coins.