Introduction to Komodo KMD. Part 2

Hashes, nonces, and security of the Bitcoin blockchain.

To create hashes, the Bitcoin network uses cryptography algorithm called SHA-256, which was created by the United States National Security Agency. A hash of a block on the Bitcoin blockchain serves as a stamp that seals the block.

The task of creating a hash for a set of data even using a very strong cryptography algorithm is a trivial task for modern computers, which is why the Bitcoin network also has a parameter called difficulty. Difficulty means that a hash that miners come up for a block needs to be smaller than the hash for the previous block. Practically speaking, this means that hashes of the blocks on the Bitcoin blockchain have a lot of zeros in the beginning. For example, hash for the block 510059 is 0000000000000000003e74b1ab42a63511a27ea6f9e98b822a3e2cfa15f3d950 and hash for the block 510062 is 000000000000000000043dd19da37f77807f37b5dc0a6a5cabf2363114dfca21. Coming up with hashes that have all the zeros is the reason why miners need to buy expensive equipment to create blocks of the Bitcoin blockchain. To incentivize miners to create the blocks, the Bitcoin blockchain rewards them with block creation rewards. These rewards are the way for the network to add new Bitcoins to circulation.

Satoshi Nakamoto has designed the Bitcoin network in such a way that it can only have 21 million bitcoins total. When he launched the network in 2009, the reward for block creation was 50 bitcoins. The reward stayed the same for 210,000 blocks. Then, it divided in half and became 25 bitcoins. After the next 210,000 blocks, it decreased again and became 12.5 bitcoins.

The Bitcoin network aims to create a block of the Bitcoin blockchain every 10 minutes, which means that the next division of the reward will occur approximately in June of 2020. The speed at which the Bitcoin network adds coins to circulation also means that out of all Bitcoins that the network will ever create, over 80% of the coins are already in circulation (over 16.5 million out of 21 million). As of the beginning of 2018, the total amount of bitcoins that would be created in the future was close to 4 million coins. You can see the current up-to-date information about the number of bitcoins in circulation as you are reading this article by visiting http://www.bitcoinblockhalf.com/

How can miners come up with various hashes if one set of data can only have one hash in the same cryptography algorithm and the goal of the Bitcoin blockchain is to preserve information about transactions and not modify it? They do so by adding a number to sets of data. Sets of data include information about transactions and miners don’t change this information. However, they are free to add a number to this information. Because hashes of sets of data change dramatically when even a tiny part of the data changes, this allows miners to come up with an infinite number of hashes.

The number that miners add to the data is called nonce, which is short for number used once. The goal of the miners, therefore, is to choose a nonce that will result in the creation a required hash.

Once a miner on the Bitcoin network comes up with the winning hash, both the hash and the nonce become a part of the Bitcoin blockchain. This means that anyone can examine the data about transactions, the hashes and the nonces. You can see all this information if you visit Bitcoin blockchain explorer at https://blockchain.info/

For example, block #510066 has information about 1127 transactions. The total volume of these transactions has been close to 500 bitcoins. The winning nonce was 1817214810. The winning hash was 0000000000000000005cabc1047747a12e81bcd18bdb7e8e41e6a4a1ed450244. The miner to come up with this nonce for this block was F2Pool.