This is one article in a collection of 52 articles published weekly throughout 2023 on the basics of Bitcoin. The series is intended for people unfamiliar with Bitcoin or people wishing to enhance their understanding of the fundamentals that underpin the technology. Please contact us, if you have any questions or comments.
In the our previous publication we established that miners earn the right to mine a block, if the miner inputs a block header that produces a hash value that is less than the target hash. The next important question is what are the contents that make up a block header? The block header consists of these items in the following order:
- The version. This field dictates the block validation rules to follow. While this field could change when the Bitcoin protocol undergoes changes (something that does not occur frequently), this will be a static field for day-to-day mining.
- The previous block’s header hash. This field represents the hash value of the previous block’s header. This is what creates the blockchain as all the blocks point back to the previous block. A miner has no control of this part of the input as it is solely dictated by the previous block. Every miner attempting to mine the next block will have an identical previous block’s header embedded in the block header being put into the hash function (this is not entirely true but we will explore this nuanced topic later in the series). However, each new block that is mined will have a unique input associated with the previous block’s header as the SHA256 hashing algorithm is collision resistant. Consequently, each new block that is mined creates a different problem that miners must solve.
- Transactions of the current block. A Bitcoin block will include transactions transferring bitcoin between the network’s users. The Bitcoin protocol limits the block size to 1 megabyte. While the number of transactions can vary from block to block there are approximately 2,000 transactions per block. The Bitcoin protocol utilizes a Merkle tree to represent these transactions using the SHA256 hashing algorithm for each transaction in the block. We will explore the brilliance of Merkle trees in a future publication in the series, but this technology allows all the transactions to be expressed as a hash function (if you want to learn about Merkle trees now, a subject that is always a hot topic at a cocktail party, this video does a great job of explaining these concepts for visual learners). Miners have discretion to change the transactions in the block. Consequently, miners have discretion over this input. However, miners have an incentive to pick the transactions which have the greatest fees associated with them.
- The timestamp. The time stamp provides an approximate time of the creation of the block. The time is measured from the time the miner started to attempt to mine the block.
- The difficulty target. This field measures the difficulty target of the block and will change every 2016 blocks when the difficulty adjustment occurs.
- The nonce. The word nonce is an abbreviation for number only used once. A miner has full discretion for the input. The miner is attempting to produce a hash value that is lower than the hash target.
All of these items make up the block header which is then placed into the hash function. As currently constructed, there are 2 to the 96th power nonces available for bitcoin miners to select given the items the miner has the discretion to change in the block header. That number is an eight followed by 28 zeros.
As discussed above, each new block that is mined has a block header that points back to the previous block. This continuous string of blocks creates the Bitcoin blockchain. To determine a block's placement in the blockchain a person would reference the block's height. Block height simply refers to the order in which the block was mined. Currently, the block height is around 775,200. Put differently, this means that 775,200 blocks have been mined to date. Remember a halving occurs every 210,000 blocks. So, Bitcoin's fourth halving will occur when the block height is 840,000.