Introduction to Bitcoin Cash (BCH) Part 2

Immutability, difficulty, and nonces on the Bitcoin and Bitcoin Cash blockchains

 

How hashes provide the Bitcoin network with immutability

On the Bitcoin network, each subsequent block of the Bitcoin blockchain contains the hash from the previous block, which, in turn, contains the hash from the block preceding it and so on. Obviously, because the blocks on the Bitcoin blockchain contain information about hundreds and thousands of transactions on the Bitcoin network, hashes are much longer than the hashes in the example above. For example, the hash for block #531032 of the Bitcoin blockchain is 0000000000000000003e397987967168be42d32e559e7ca53281b51cb5f920a7. The page for this block, located here https://blockchain.info/block/0000000000000000003e397987967168be42d32e559e7ca53281b51cb5f920a7 also contains the hash for the previous block, block #531031, which is 0000000000000000003eeb9cc3a2a5de4c75745817cf306a3d8310f4d02548fb. The page for this block, block #531031 contains the hash for the block #530030 and so on. This is how all the blocks on the Bitcoin blockchain are linked and this is the reason why it is not possible to change the information on a blockchain once the information becomes part of the blockchain.

 

Difficulty and nonces on the Bitcoin and Bitcoin Cash blockchains

The speed of block creation on both the Bitcoin and Bitcoin Cash networks depends on the parameter called “difficulty.”

The Bitcoin network adjusts its difficulty every 2016 blocks. The Bitcoin Cash network has very specific rules about how it adjusts the parameter of difficulty. For example, it decreases difficulty when Median Time Past (MTP) of the current block (which is a median value of the latest eleven blocks on the Bitcoin Cash blockchain), and the MTP of the previous six blocks is larger than twelve hours.

In practical terms, “difficulty” sets target hashes for blocks of blockchain. Difficulty means that the hash for a block needs to be smaller than the target hash.

However, a set of data can only have one hash under a cryptography algorithm. This means that if the miners on the Bitcoin network or Bitcoin Cash network were simply to create hashes for the data about transactions on the networks, the hashes would be the same because the data is the same. This is why the goal of the miners is to find a number that they can add to the data about transactions that generates the winning hash. This number is called nonce, or number that can only be used once.

As explained before, changing even one digit in the data about one transaction or adding a number would change the hash significantly. For example, let’s say you have a set of data (1, 1, 3) and the hash is E4r. On the Bitcoin network, you would be looking to add a number in such a way that the hash begins with zero. You could try adding 4 and getting a hash for (1, 1, 3, 4) and seeing if the hash will be starting with zero and so on. On both Bitcoin and Bitcoin Cash networks, hashes are very long strings and target hashes begin with a lot of zeros, which is what makes finding them so complex and which is why both Bitcoin and Bitcoin Cash are such secure networks.

One of the properties of cryptography hashes is that once you know the hash, you can easily check the validity of the data, but you can’t recreate the data if you only have a hash. This means that because blocks on the Bitcoin and Bitcoin Cash networks have target hashes, the only way for miners to come up with a winning hash is to use the original data about transactions and add a nonce to them. Generating the nonce using target hash is impossible.

Because both Bitcoin and Bitcoin Cash are fully transparent networks, once a miner finds a winning nonce and generates a winning hash, both the hash and the nonce become a part of the Bitcoin blockchain and anybody can verify that the nonce indeed satisfies the conditions because the data is available, the nonce is available, the target hash is known and the winning hash is also a part of the Bitcoin blockchain.

For example, block #521060 of the Bitcoin blockchain had 1351 transactions. The winning nonce for the block was 1918309454 and the winning hash was 0000000000000000000e2a5b5b2c7ae150c158c8f483d1d9a300d9b0c9a64f0a. This information is available for every block of the blockchain at https://blockchain.info