A Bitcoin block is a fundamental component of the Bitcoin blockchain. It is a data structure that contains a collection of transactions that have been verified and grouped together by miners. Each block contains a and a . block header block body Block Header The block header is an segment at the beginning of each block. It contains essential information about the block, including: (We’ll take block number as our reference) 80-byte 795,633 Version (4 bytes) A numerical value representing the block version. It indicates which set of block validation rules to follow. It is an unsigned integer that is encoded in little-endian format. For example, the version field of the block header for block number is in decimal, which is in hexadecimal. 795,633 536969216 0x20018000 The version field can be interpreted as a , where each bit can be turned on or off to indicate support for a certain feature or protocol upgrade. bit field For example, of the version field are reserved for , a mechanism that allows miners to signal readiness for a soft fork. t is reserved for , a proposal that activated by requiring miners to signal bit 1 on all blocks. The fifth bit is reserved for , which defines SegWit and its activation logic. the first three bits BIP9 The fourth bi BIP91 SegWit BIP141 Previous Block Hash (32 bytes) The previous block hash is a hash of the previous block’s header. It links the block to its parent block, forming a chain of blocks. SHA256(SHA256()) ? There are two times SHA256 because it is a way to make the hash function more secure and resistant to certain types of attacks. Why are there two times SHA256 Bitcoin uses double hashing with , which is denoted as . It does this for various reasons, such as making the proof-of-work algorithm more secure, ensuring the integrity of the transactions and blocks, and preventing length-extension attacks on the block headers. SHA256 SHA256(SHA256()) Previous Block Hash also affects the difficulty of finding a valid block solution. The difficulty target is adjusted every 2016 block (approximately two weeks) based on the timestamps of the previous blocks. The previous block hash determines which blocks are considered as previous blocks for this calculation. Previous Block Hash ( 795,633): 00000000000000000001d6fa5edbea6a697167f478be6a97d4f22c274d5c2fb3 Merkle Root (32 bytes) The Merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header. I won’t go in-depth here because I have already published two detailed articles on it. I’ll provide the link for your reference. https://0xkishan.medium.com/merkle-tree-a-blockchain-perspective-c57218a8177c?embedable=true Merkle root for ( ): 795,633 8ac3cfc68465375943e1c625e3a1c6c02d4f7d2fd66cd91b68165fcc152d9f6f Timestamp (4 bytes) The timestamp of when the block was mined. Block 795,633 was mined on Jun 24, 2023, 12:02 AM UTC. Difficulty Target (4 bytes) A value representing the mining difficulty level at which the block was mined. It was 52,350,439,455,487.47 for Block 785,633. Nonce (4 bytes) A random value that miners change in order to find a valid block hash. It was 3,492,054,801 for our Block in reference. Block Body The block body is the part of the block that has all the transactions. Transactions are the records of who sent and received bitcoins. In other words, transactions represent the movement of Bitcoins from one address to another. Each transaction contains the following elements: : A unique identifier for the transaction derived from hashing the transaction data. Transaction Hash ID : The sources of Bitcoins for the transaction, specifying the transaction outputs from previous transactions that are being spent. Inputs : The destinations for the Bitcoins being sent in the transaction, specifying the amounts and the receiving addresses. Outputs : The difference between the total value of the transaction inputs and the total value of the transaction outputs. It serves as an incentive for miners to include the transaction in a block. Transaction Fees Let’s take an example from our reference block . You can view all the transactions present in this block by going to any Bitcoin blockchain explorer and pasting the transaction hash. Let’s take an example of a transaction with hash: 795,644 76060e5f6947dd875ab84f41a8ee87d9b9344f25a6737b9502d42bc9c90fba20 Hash ID: 76060e5f6947dd875ab84f41a8ee87d9b9344f25a6737b9502d42bc9c90fba20 Inputs: 1 ( ) 1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g Outputs: 2 ( , ) 1AWYVZvfQvGGsaTNePKKWAxPQkWuC6ZvdY 1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g Transaction Fees: BTC 0.00058200 Here’s a JSON { "txid": "76060e5f6947dd875ab84f41a8ee87d9b9344f25a6737b9502d42bc9c90fba20", "size": 225, "version": 2, "locktime": 0, "fee": 58200, "inputs": [ { "coinbase": false, "txid": "3a204a0a1e34dccda0f1a528b88e0aa462d36becc1396da04149c77d40ea0922", "output": 1, "sigscript": "47304402206bb01734130b7d75d5dfbe39b3f9f8f388cfb12d897fb1bcaf5ca17d0caa19ca02202e7e50ca859d592d137b08cf1359cf9dda39e268760ba63702c71ab18115f973012103786af4b32017ec640dba2d2a7e1fd5aa4a231a658e4cbc114d51c031576e19bc", "sequence": 4294967293, "pkscript": "76a914cebb2851a9c7cfe2582c12ecaf7f3ff4383d1dc088ac", "value": 44202007434, "address": "1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g", "witness": [] } ], "outputs": [ { "address": "1AWYVZvfQvGGsaTNePKKWAxPQkWuC6ZvdY", "pkscript": "76a914684f7bcd2d8da9d5ea582b27661e744bd0a7c22888ac", "value": 5800100, "spent": true, "spender": { "txid": "4a11ff43c023fda8b18382aa4e12776f8ade15c36890306aaf6655b8c0d45600", "input": 50 } }, { "address": "1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g", "pkscript": "76a914cebb2851a9c7cfe2582c12ecaf7f3ff4383d1dc088ac", "value": 44196149134, "spent": true, "spender": { "txid": "504a0abfbd68e09421bca12239853c35b680592c8a39190e8df634a069ac27db", "input": 0 } } ], "block": { "height": 795633, "position": 5 }, "deleted": false, "time": 1687564195, "rbf": false, "weight": 900 } There is some additional information, such as the , which gives us information regarding the index of the transaction in the block. position The block body also has a special transaction that gives bitcoins to the miner who found the block. It is called the , which is the first transaction (position: 1) in the block. It has no inputs but has one or more outputs, which specify the reward for the miner who found the block solution. Coinbase transaction The miner gets some bitcoins as a reward for finding the block and some bitcoins as fees for including the transactions in the block. In the case of our reference block, the transaction id for that special transaction is: a2acdd6473c049a7cf1ca38ce91e6cb0a9e6099a90e0749f2a183e320478fe6f You can copy this transaction id and search for it in any Bitcoin Explorer for additional details. How are Bitcoin Blocks Created? Bitcoin blocks are created by miners, who are responsible for verifying transactions and adding them to the blockchain. Miners use powerful computers to solve complex mathematical problems, and the first miner to solve the problem and validate the transactions in a block is rewarded with newly created bitcoins. Once a block is created, it is broadcast to the network, and other nodes on the network validate the block before adding it to their own copy of the blockchain. I have written a detailed article explaining how this works. Please refer to the following article. https://0xkishan.medium.com/the-quest-for-digital-gold-unraveling-the-proof-of-work-puzzle-a7d98a790a7?embedable=true Conclusion In summary, Bitcoin blocks are a fundamental building block of the blockchain and are responsible for ensuring the security and immutability of the Bitcoin network. Without blocks, the blockchain would not exist, and the entire Bitcoin ecosystem would be compromised. Understanding how blocks work is essential for anyone looking to learn more about Bitcoin and the wider world of cryptocurrencies. Also published . here