How Bitcoin works – episode 5: mining

Up until now the story of Bitcoin island was pretty straightforward. The Bitcoin island is a sophisticated keeper of records of land ownership on the island. Each piece of land has a label attached to it with an anonymous public identification number. This number identifies the owner and is at the same time a clever locking mechanism which makes sure only the owner of the corresponding private key can move the ownership to someone else.

Bitcoin mining is a topic that will complicate things as it doesn’t really have a good counterpart in everyday life. Nevertheless, it is one of the most important aspects of the Bitcoin island and we must try to understand it.

Bitcoin mining is actually a process in which transactions (changes of ownership from episode 4) are made official and stored in the island’s book of records. Every time an owner makes a transaction, it doesn’t get processed immediately but instead is collected in a basket of all transactions.

basket-of-transactions

Every time a transaction is published, it first travels to a basket where all transactions are gathered and waiting to be officially recorded.

The Bitcoin island is always receiving transactions submitted by owners, but doesn’t make them official immediately. Instead it just reviews if the contract has all the necessary requirements and structure as described in episode 4. If all checks out,  the contract travels to a basket of all transactions. The Bitcoin island then publishes the transactions and records the changes in bigger batches that are called “blocks“. The island tries to publish a block on average once per ten minutes.

Now the is: why doesn’t the Bitcoin island just publish transactions immediately after receiving them? The answer is that the island doesn’t have the ability to decide which contract should be made official if an owner tries to cheat and submit multiple different transactions that change ownership of the same land to different owners at the same time.

Imagine Peter owns 4 bitcoins of land and makes a transaction that transfers the ownership to Joe. But Peter is a dirty cheater and also makes an additional transaction that changes ownership of the same land to Jane. And because he likes cheating a lot, he also makes an additional contract that changes ownership of the same land to his brother Mike. Now there are 3 contracts in the basket of transactions that are in conflict with each other because each of them is a contract  for transferring the same piece of land to a different new owner. As great as the Bitcoin island is, its weakness is that it is unable to decide which of these 3 contracts shall be made official and which 2 will be discarded as invalid. The island needs help from the outside to solve this situation.

To solve the problem described above, the Bitcoin island has created an ingenious system for selecting a different person to make the decision for each new block. This system is called “mining” and resembles a slightly complicated lottery. The island runs a game in which it generates a crystal that occupies an area of land on the island:

crystal

If there is a crystal on a piece of land, it cannot be used (owned) by anyone. Only pieces of land without crystals on them can be owned.

This crystal can be removed by a special pick-axe. The problem is that each crystal is different and can only be removed by a specific pick-axe, but the number of possible pick-axes to choose from is very big.

pick-axes

Only some of the pick-axes can remove the crystal, but the number to choose from is very big.

The only way to find a pick-axe that can remove the crystal is to keep randomly trying them one by one until the correct one is found. This means that the “mining” game resembles a lottery, because finding the correct pick-axe is a matter of luck, but it is also expensive because a certain amount of time and energy is required to select and try a pick-axe. In the real world this process is actually simulated by computers and requires a lot of computational power and electricity.

In order to motivate people to join the game, the island offers a reward. Specifically, the winning “miner” (a person who found a pick-axe that can remove a specific crystal) can keep the land that was originally occupied by the crystal. The winner also gets the basket of all collected transactions and a right to select which of these transactions will be made official – especially determining which of multiple conflicting transactions is officially announced as legitimate and which are discarded.

Once the game has a winner and transactions are published, a new round of the game begins (Bitcoin island collects transactions in the basket and miners are trying to find a pick-axe to remove another crystal). The Bitcoin island tries to make each round of the mining game last 10 minutes of average. It influences the duration of rounds by modifying the number of pick-axes to choose from. If too many miners join the game and find new blocks faster than every 10 minutes on average, the island increases the number of available pick-axes and makes the game more difficult.

Let’s sum up what we have said about mining:

  • the Bitcoin island collects all submitted transactions in a basket of transactions and makes them official in batches also called “blocks“, on average once per 10 minutes
  • the Bitcoin island lacks the ability to decide which transaction should be made official if 2 or more transactions contradict each other
  • to solve the problem it selects a helper who is given authority to decide any conflict between transactions
  • the helper is selected in a game called mining
  • mining is a game in which the Bitcoin island creates a special crystal occupying a piece of land. Miners (players playing the game), try to find a pick-axe that can remove the crystal.
  • the number of pick-axes is very big and a lot of trial and error is necessary to find the right pick-axe
  • winner of each round of the game is rewarded the land which was originally occupied by the crystal and also receives the authority to decide which of the conflicting transactions will be made official and which will be discarded

Miners are important because they help the Bitcoin island simulate authority. Without them the island would have no way of deciding which transactions are official and the record keeping wouldn’t work. We will explore mining in greater depth in future episodes.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s