# What is the problem that mining solves?

Of course, the function of mining is to secure the blockchain, but I'm looking for a more abstract summary of what the exact problem is that mining tries to solve? I believe its called the Byzantine Generals problem, but can it be described in a couple of sentences?

The network needs to select one random stranger out of a large group at a fixed schedule, and uses a 'hashing-lottery' as a reasonably fair method to do so. Is that a good definition of the reason why POW is needed?

In other words: Suppose I developed an alternative method to select a random p2p node every few minutes, who gets to publish the next block, could that replace cpu-based proof of work?

• @David The title may be duplicate, but the question is totally different. I know all about hash collisions and the technical background of mining, I just want to know what properties an alternative should have to be able to replace mining. Nov 9, 2013 at 13:22
• @David: the question is (obviously) totally different. And interesting! Nov 9, 2013 at 17:32

In my opinion, it is one of the greatest misconceptions about Bitcoin that miners solve a "hard problem". Many news sources explain it like that, but in fact it's not true.

All a miner does is guessing until he got something right. A miners takes his block of transactions (including the coinbase transaction that sends the fees and block reward to himself) and calculates the hash of it. Hash calculation is a very common procedure and is not at all "hard". The hash he gets needs to match a certain condition. This condition gets harder as more miners try it (see Difficulty). When the miner got a hash that fits the condition, he can publish it to all other Bitcoin clients and the block is added to the block chain.

The reason that miners with more computer power have a larger chance of winning the block is because they can simply guess faster. They can calculate more hashes per second to test against the condition, (Mining power is expressed in Hashes/second.)

The need for proof-of-work is there because the Bitcoin protocol wants that a block is found only once every 10 minutes approximately. So, as more miners enter the game, it has to become harder to do. The POW makes sure that finding a block is not easy and takes the some time. That's also the reason that the difficulty raises as more people mine. Every 2 weeks, the algorithms adjusts the difficulty so that again one block is found every 10 minutes at the average hashpower of the previous two weeks.

So, to answer your second question: If you could find an alternative method for achieving exactly the same thing as currently is done in Bitcoin mining, it could replace it. But Bitcoin is programmed as it is and won't probably ever change this method. But there are alt-coins that use different methods for distributing the coins and securing the block chain.

• In fairness, I call mining math "hard" not because it's an objectively difficult problem but because it's unlikely you or I would have an easy time doing 2 rounds of sha256 with a pencil and paper. Nov 8, 2013 at 16:59
• It's often called a "hard mathematical puzzle" of which you have to find a solution. Which is not the case. But indeed, although every single computer sold today can perform a sha256, it's not something many people can do by hand :) Nov 8, 2013 at 19:50

In a nutshell, mining solves the problem of achieving a globally agreed ordering of transactions and selection of one of several incompatible transactions.

Here's the problem that needs a solution:

If I have 10 Bitcoin and I simultaneously introduce to two distant parts of the network a transaction that gives 10 Bitcoin to Alice and a transaction that gives 10 Bitcoin to Bob.

Different nodes (wallets etc) will receive the two transactions in a different order, some get the Alice transaction first and reject the Bob transaction as a doublespend attempt. Others vice versa.

How does the whole world eventually agree which of Bob and Alice have the 10 Bitcoin?

Mining provides a mechanism for periodically selecting a node that specifies an ordering (and hence chooses which transaction gets rejected). It also provides the basis for resolving conflicting views of transaction-order between parts of the network.

Mining provides an immutable and verifiable continuous record of this ordering.

I think the concern was that a p2p node is easier to falsify than a solution that requires great effort.

With mining that takes time, synchronization gets easier. Forks happen in the blockchain and these forks need to be resolved, where the nodes select the chain that is longest.

It is very hard for distributed nodes to resolve and come to an agreement if new blocks are added to forked blockchains simultaneously at high speed in different parts of the network.

Another reason is if several miners work on similar blocks, it is unlikely that they will finish at the same time, since the random number that generates a small enough hash could come at any time, which most likely means very different times for different miners, so one wins clearly.

That is how I understand the need for mining.