# How can a block be considered more difficult to solve/hash than another one?

It is said:

Because of all this work, when a Bitcoin client signs on to the network it can trust the block chain that was most difficult to produce (since this is evidently the one that was being worked on by the most miners).

There is nothing evident there :)

Can someone explain how can a block be more difficult to solve than another one? Does it have to do with the number of transactions it contains?

All blocks have a field for their 'difficulty'. This is a parameter that determines how many hashes have to be calculated (on average) before you find a block. Higher difficulty means the block will be harder to solve.

How can a block be considered more difficult to solve/hash than another one?

Think of it like flipping coins, where the difficulty number is the number of Heads you have to flip in a row. So, With difficulty 8, you have to get 8 heads in a row, etc. Difficulty 9 is harder than a difficulty 8.

This difficulty number is used to increase/decrease the number of blocks solved on the network, according to very specific rules, in order to keep blocks solved at an average of 10 minutes. If the network is solving too many blocks, say a block every 9 minutes on average, then the network will increase the difficulty. Similarly, if the network is only solving blocks every 11 minutes at the current difficulty, then the difficulty is lowered. This re-adjustment process happens every two weeks in Bitcoin.

The tricky part is what can happen if a fork takes place at the same time as the difficulty adjustment. Let's say our blockchain looks like this:

X_8
/
-> X_8 -> X_8
\
X_8

(Where 8 is the difficulty of each block). Since the top fork and the bottom fork have different time fields in their block header, they result in a different difficulty re-adjustment calculation (difficulty re-adjustment is based on number of blocks in a given time, trying to keep it at a block per 10 minutes). Now the next blocks on either side of the chain, which have the newly calculated difficulties, at not given the same weight.

X_8 -> X_9
/
-> X_8 -> X_8
\
X_8 -> X_7

Since the difficulty re-adjustment in the top fork ended up with a higher difficulty, any block solved on that half of the chain (X_9) will override a block solved on the bottom side of the fork (X_7). However, if X_7 had been solved significantly before the X_9 block, then that would be the chain with the most work (8 + 7 on the bottom chain is better than just 8 on the top chain).

The network essentially looks for the chain of blocks with the highest sum of difficulties, i.e. the chain that took the most work to produce, and would be the hardest for an attacker to try to override. Nodes on the network choose this highest-difficulty-sum chain as their correct chain, and the great thing about this is that when everyone follows the simple rules, they arrive at consensus about the history of transactions.

Does it have to do with the number of transactions it contains?

No.

Block difficulty is determined only by the sum speed of miners working on that chain particular chain, kept track of by evaluating the the spacing of the timestamps of blocks in a 2 week period. It's worthwhile to think about the block chain as a tree that just happens to have a very strong main branch, where branches are weighed by how much work went into creating them rather than their length.

+---> 9 +---> 9
9 +----> 9 |
+---> 1 +---> 1 +---> 1 +---> 1 +---> 1

Here we have two competing tips of the chain, one with a cumulative difficulty of 36 (9+9+9+9, and one with a cumulative difficulty of 25 (9+9+1+1+1+1+1). Although the top section of the fork has less blocks, it has a higher difficulty than the bottom fork and so is regarded as the current "best" side of the chain.

• "by the sum speed of miners working on that chain particular chain" => do you mind explaining that better, for the mere mortal? Sep 5, 2015 at 6:12
• The time between blocks is made to target 10 minute intervals on average. If the miners go too fast, the difficulty of making blocks is raised in the next period. If they go too slow, the difficulty is lowered. Sep 5, 2015 at 21:52