When discussing bitcoin mining, the term of ‘blocks’ usually appears in the conversation. In today’s article, we will be taking the time to explain what a bitcoin block really is.
What is a Block?
A block is where files of transaction data are permanently stored. Blocks are structured into a linear structure over time, which comes to be known as blockchain.
New transactions are continuously being integrated into new blocks which are then placed at the end of the chain. The more blocks are being added to the blockchain the harder and harder becomes to alter or remove the older ones, thus making bitcoin’s transaction irreversible and immutable. A bitcoin block usually has on average more than 500 transactions. As an example, Bitcoin Cash (a bitcoin hard fork) has a block size of up to 8MB, which allows more transactions to be processed per second.
Each block is comprised of a record of recent transactions, a mention to its previous block, and the solution to a complex algorithm which is unique to each block. New blocks cannot be added to the network without having the correct solution. The act of “mining” involves finding the answer which will solve the current block.
The mathematical puzzles have a high degree of difficulty, but once the correct solution is identified, the rest of the network can easily confirm the validity of the solution. There are more solutions that can be considered valid for each block, but only one of them has to be found so that the block can be added to the chain.
Since a reward of newly issued bitcoins is given when solving each block, every block has recorded which Bitcoin addresses or scripts must receive the rewards. This record is called a generation transaction, or a coin-base transaction, it will always be the first transaction to appear in the block. Bitcoins at first were generated 50 per block completion, and the number keeps on having at every 210,000 blocks (about four years). This means that at block 210,000, the block creation fee was lowered to 25 BTC, and 12.5 BTC will be produced at block 420,000, ultimately leading up to 0 satoshis with the completion of block 6,930,000.
Bitcoin transactions are sent to the network and all of the sender’s peers that want to solve blocks, gather the transaction registers and then add them to the block that they’re trying to solve. Miners are motivated to put transactions in their blocks due to afferent transaction fees.
The block difficulty is automatically adjusted by the network so that on average a target of 6 blocks are solved each hour. At every 2016 blocks (solved in approximately 2 weeks), all Bitcoin clients compare the number generated to adjust the target goal according to the percentage it varied. A consensus is then reached by the network and the lock difficult is automatically increased or decreased.
If two different valid solutions are found simultaneously for the same block, then the network accepts the ‘longest’ chain of blocks as being the valid one. The ‘length’ represents the chain with the most combined difficulty, not the one that has the most blocks. This is done to prevent forking the chain and generating multiple low-difficulty blocks.
A block is comprised of a header and a long array of transactions.
The header is made out of block metadata. In a header there are three types of metadata:
- The preceding block hash. In a blockchain, each block inherits from the preceding block because the hash of the previous block is needed to generate the new block’s hash. Thus, every N block is given the hash of the N-1 block.
- Mining competition. For a block to be added to a blockchain, it has to receive a valid hash. This is comprised of a timestamp and a difficulty.
- The merkle tree root. This data structure summarizes all the transactions in a block.
For block identification, it is required that you have a cryptographic hash, which is considered to be a digital signature. This is generated by hashing the block header twice using the implementation of a SHA256 algorithm.
As we mentioned above, every block uses the previous block’s hash to build its own hash. The block hash represents an identifier which is unique. This means that no two blocks will have the same hash.
Another way of identifying a specific block is by the height of the block. This represents the blocks position in the blockchain. Unlike a hash, a block’s height is not unique. More blocks can compete for the same position if a fork was there to occur in the blockchain.
A merkle tree or binary hash tree is a structure in which all transactions in a block are recorded.
A merkle tree consists of a function that recursively hashes pairs of nodes (in our case, transactions), until only one hash is left, which is called the root or merkle root. In the Bitcoin world, the cryptographic hash algorithm that is used for hashing is SHA256, and this is applied twice each time.
We hope that our article has answered to some of your questions regarding Bitcoin blocks. Of course, there is still so much to explain about this system, but now you have a broader idea about what is going on in the mining process and what block actually represent in the blockchain structure.