What You Need To Know To Understand Blockchain Technology Part 7

Block generation on a blockchain.


Satoshi Nakamoto has created the Bitcoin network is such a way that it tries to generate a block of the Bitcoin blockchain every ten minutes. This rule exists because of the choice of the creator of the network. Many of the other blockchain networks create their blocks much faster. For example, as you can see here https://etherscan.io/chart/blocktime Ethereum creates its blocks in around fifteen seconds per block.

All the numbers in the paragraph above are approximate because they talk about the block creation in the perfect world. However, there is no such thing as the perfect world, which is why sometimes block creation takes longer and sometimes it takes faster. You can see how long it is taking the Bitcoin blockchain to create the blocks as you are reading this article by visiting https://blockchain.info/ In the “age” column you will see times. For example, if the times from top to bottom are 5 minutes, 11 minutes, 12 minutes, and 15 minutes, it means that the Bitcoin blockchain has created its latest block 5 minutes ago. It took the network 6 minutes, 11 minus 5, to create the previous block, one minute, 12 minus 11, to create the block before that, and three minutes, 15 minus 12, yet another block before that.

Difficulty on the network helps the network accomplish two goals. First, it helps the network keep creating the blocks of its blockchain at a somewhat constant speed. The Bitcoin network changes the difficulty every 2016 blocks. If the network were to create one block in exactly ten minutes, then it would take it two weeks to add 2016 blocks. For this reason, when it comes the time to adjust the difficulty again, if the network has created the last 2016 blocks faster than in two weeks, then the difficulty goes up. If it has created the blocks slower than 2016 in two weeks, then the difficulty goes down.

In practice, difficulty means that a target hash for a block needs to begin with a certain number of zeros. This is also the reason why if you examine hashes for a number of the blocks of the Bitcoin blockchain, you will notice that all of them start with a lot of zeros. For example, the hash for the block #528997 is 00000000000000000026027759816132fa42e540c89d300e42ba26cf4f16c80b, the hash for the block #528996 is 0000000000000000000ae9777d92adffe062ffbaa842e75170ffc5088c4d87aa, and

the hash for the block #528995 is 0000000000000000000ec880d187bd7918bc6276f036bc038803ec97de8d5f69.


Nonces in mining

A set of data, such as data about transactions on the Bitcoin blockchain, can only have one hash when a network uses one hashing function. This means that if all miners were doing was creating hashes for transactions, they’d all be getting the same hashes and there would be no way to modify the hashes or create a hash that would correspond to the current difficulty of the network.

For this reason, the goal of the miners is not just to compile the transactions on a network into blocks of blockchain, but also to seal them with hashes that correspond to the network difficulty.

On proof-of-stake blockchain networks, there may be no difficulty and there may be a voting mechanism, but the principle remains the same: the goal of miners or delegates is not just to collect all the transactions into a block of data, because this in itself is a trivial task for almost any modern computer, but also to seal this data in such a way that makes the data immutable.

On the Bitcoin blockchain and other blockchains that use proof-of-work as their consensus algorithm, miners come up with a target hash by adding a random number to data about transactions. This random number is called nonce, which is short for number used once.

Therefore, the job of the miners consists of compiling transactions and then trying out adding random numbers to the data about transactions until one of those random numbers together with the data about transactions returns a winning hash under the hashing function. When this happens, the miner that comes up with the winning nonce and winning hash gets the right to add a block to the blockchain and gets the reward from the network.

It may seem strange that the job of miners includes guessing a random number and that adding blocks to a blockchain depends on a random number. It is important to remember here that public networks such as Bitcoin are fully transparent. First, this means that the programming code of the software on the network in open source and available to anyone to inspect to see that there are no hidden functions and the network chooses winners honestly.

This also means that once a miner comes up with a winning nonce and creates a block of the blockchain, this random number also becomes a part of the block and a part of the blockchain. The identification of the miner on the network also becomes a part of the blockchain. For example, the winning hash for the block #529000 of the Bitcoin blockchain was 00000000000000000033273ba6a5908c9ca1b8966ef499dcdc683ea37b96166d, the miner who created it was BTC.com and the nonce that allowed BTC.com to produce the winning hash was 262900014.

All of this information stays on the blockchain forever, just like does the information about all the transactions that have happened on the network since its inception in 2009. This means that anyone can check everything, including how software works, how often certain miners are winning, if the hashes are really the winning hashes under the SHA-256 hashing function and if the nonces that become a part of the blockchain actually do generate the winning hashes. It is this full transparency that allows the Bitcoin network and other public cryptocurrency networks earn and keep the trust of people that are using the networks.