From cc960cf2dc43aa4ee6636fcd8486046aff531d8c Mon Sep 17 00:00:00 2001 From: 1HXb9KMAtwNJqz4egi6hJx08EQgJajiBTH <1HXb9KMAtwNJqz4egi6hJx08EQgJajiBTH@bitcoin.cash> Date: Wed, 11 Dec 2019 16:14:12 -0500 Subject: [PATCH] wiki commit --- protocol/blockchain/block/block-header.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/protocol/blockchain/block/block-header.md b/protocol/blockchain/block/block-header.md index 8436135..6dbd63f 100644 --- a/protocol/blockchain/block/block-header.md +++ b/protocol/blockchain/block/block-header.md @@ -1,2 +1,23 @@ # Block Header +Block headers serve an important intermediary role in the creation and transmission of blocks. They are a fixed-width (80-byte) representation of the entire block. With a block header, you can: + + 1. Calculate the hash of the block + - The double SHA-256 hash of the block header + 2. Confirm the proof of work was executed correctly + - See [Difficulty Adjustment Algorithm](/protocol/blockchain/proof-of-work/difficulty-adjustment-algorithm) for more details + 3. Determine the relative location of the block in the blockchain + - Using the previous block hash contained in the header + +Since validation of all the transactions in the block can be expensive, the ability to perform these checks on the block before downloading and validating its transactions helps make denial-of-service attacks on the network significantly more expensive for attackers. + +## Block Header Format + +| Field | Length | Format | Description | +|--|--|--|--| +| version | 4 bytes | unsigned integer[(LE)](/protocol/misc/endian/little) | The block format version. | +| previous block hash | 32 bytes | block hash[(LE)](/protocol/misc/endian/little) | The hash of the block immediately preceding this block in the blockchain. | +| merkle root | 32 bytes | merkle root[(LE)](/protocol/misc/endian/little) | The merkle tree root of the transactions in the block. | +| timestamp | 4 bytes | unix timestamp[(LE)](/protocol/misc/endian/little) | The epoch timestamp of the block in seconds. | +| difficulty | 4 bytes | difficulty[(LE)](/protocol/misc/endian/little) | The difficulty that the block must achieve to be valid. This value is determined by the timestamps of previously mined blocks. | +| nonce | 4 bytes | bytes[(LE)](/protocol/misc/endian/little) | A random value that is repeatedly changes during block mining in order to achieve the block hash requirements. | \ No newline at end of file