8 Distributed Ledger Technology
407
All possible hashes
Smallest hash
Largest hash
64
Difficulty target
Reject: any nonce which
results in a hash value
bigger than the difficulty
target will be rejected
Accept: during the
mining, the miner should
find a Nonce value that
the corresponding hash
value becomes smaller
than the given difficulty
target value
16 possible
SHA256
cryptographic
hash values in
Bitocin.
Fig. 8.9 How mining works. Miners search for a valid hash that satisfy the given difficulty target.
In Bitcoin nonce range contains 4 billion possible values
Fig. 8.10 Forking in
blockchain
B1
B2
Fig. 8.11 Longer chain is
adopted
B1
B2
Bnew
discarded
Therefore, in general, the nodes will validate and adopt the first recommended
block broadcasted over the blockchain, and then they will all start mining the next
recommended block. If there are two nodes that publish a valid candidate block
at the same time, conflict occurs because both candidate blocks will be added to
the ledgers on different nodes. It is very likely that these blocks contain different
transactions; therefore, the last blocks in the ledgers are not the same. If this
happens, a fork is created. The strategy to resolve this conflict is to wait for a new
block to be added. Then all nodes will adopt the ledger that has the longest chain
because it carries the greatest amount of work in a Proof-of-Work-based blockchain.
This way consensus is reached if a block should be in the ledger. The conflict (fork)
scenario is shown in Fig. 8.10 where blocks B 1 and B 2 are both valid and have been
added to the ledger, but they may contain different transactions inside. Figure 8.11
shows how a conflict is resolved – the longer chain is adopted as a valid ledger.
407
All possible hashes
Smallest hash
Largest hash
64
Difficulty target
Reject: any nonce which
results in a hash value
bigger than the difficulty
target will be rejected
Accept: during the
mining, the miner should
find a Nonce value that
the corresponding hash
value becomes smaller
than the given difficulty
target value
16 possible
SHA256
cryptographic
hash values in
Bitocin.
Fig. 8.9 How mining works. Miners search for a valid hash that satisfy the given difficulty target.
In Bitcoin nonce range contains 4 billion possible values
Fig. 8.10 Forking in
blockchain
B1
B2
Fig. 8.11 Longer chain is
adopted
B1
B2
Bnew
discarded
Therefore, in general, the nodes will validate and adopt the first recommended
block broadcasted over the blockchain, and then they will all start mining the next
recommended block. If there are two nodes that publish a valid candidate block
at the same time, conflict occurs because both candidate blocks will be added to
the ledgers on different nodes. It is very likely that these blocks contain different
transactions; therefore, the last blocks in the ledgers are not the same. If this
happens, a fork is created. The strategy to resolve this conflict is to wait for a new
block to be added. Then all nodes will adopt the ledger that has the longest chain
because it carries the greatest amount of work in a Proof-of-Work-based blockchain.
This way consensus is reached if a block should be in the ledger. The conflict (fork)
scenario is shown in Fig. 8.10 where blocks B 1 and B 2 are both valid and have been
added to the ledger, but they may contain different transactions inside. Figure 8.11
shows how a conflict is resolved – the longer chain is adopted as a valid ledger.
