Blockchain Basics

Understanding Blocks, Transactions and Hashes

Explore the core data structures that power blockchains: how cryptographic hash functions, Merkle trees, and block headers keep digital ledgers secure.

BlockchainCeylon Editorial Team
Updated:
4 min read
Understanding Blocks, Transactions and Hashes
Share:X (Twitter)LinkedIn
Educational Resource: This article is published for educational and conceptual study. Nothing in this document represents financial, investment, legal, or trading advice.

Introduction

Behind every blockchain is a set of elegant mathematical and data structure primitives. While blockchain is often discussed at a high level, its actual reliability depends on three fundamental concepts working in harmony:

  1. Transactions: The individual state transitions representing asset transfers or execution of logic.
  2. Hashes: Cryptographic fingerprints that turn any input data into a fixed-length mathematical string.
  3. Blocks: Batches of transactions bundled together and chained sequentially through hash references.

In this technical primer, we explore each of these components in depth.

What Is a Cryptographic Hash Function?

A hash function is a mathematical algorithm that takes an arbitrary amount of data as input (whether a single letter, an entire book, or a gigabyte file) and outputs a unique fixed-length alphanumeric string known as a hash or digest.

In blockchain systems such as Bitcoin, the standard algorithm is SHA-256 (Secure Hash Algorithm 256-bit).

Input: "BlockchainCeylon"
Output: 0e86b24578a1bc40c03426e2e5ec466dc7e366ffef55b25215c0e7b8c735d49e

Essential Properties of Cryptographic Hash Functions

To be suitable for blockchain use, a hash function must satisfy five critical properties:

  • Deterministic: The same input will always produce the exact same output hash, every single time.
  • Fast Computation: Calculating the hash for any given input is computationally quick and efficient.
  • Pre-image Resistance (One-Way): Given an output hash, it is mathematically infeasible to reverse-engineer or reconstruct the original input data.
  • Avalanche Effect (High Sensitivity): Changing even a single comma or bit in the input completely and unpredictably scrambles the resulting output hash.
  • Collision Resistance: It is practically impossible to find two different inputs that produce the exact same hash output.

Anatomizing a Blockchain Block

A block is not just an arbitrary list of transactions; it is a strictly formatted data structure composed of two primary sections: the Block Header and the Block Body.

1. The Block Header

The header contains metadata that identifies the block and connects it to the rest of the chain. A standard block header typically includes:

  • Previous Block Hash: The SHA-256 hash of the header of the immediately preceding block. This creates the immutable backward link.
  • Merkle Root: A single hash that summarizes all transactions included in the block body.
  • Timestamp: The approximate epoch time at which the block was created.
  • Difficulty Target / Nonce: The target difficulty threshold and the counter variable that miners alter to find a valid proof-of-work solution.
  • Block Version: The protocol version rules applied to validate this block.

2. The Block Body

The body contains the complete list of all verified transactions included in this block. In Bitcoin, a block typically holds between 1,500 and 3,000 transactions; in Ethereum, the count depends on the gas limits consumed by the smart contracts executed within that block.

How Merkle Trees Work

How can a lightweight node or mobile wallet quickly verify that a specific transaction was included in a block without downloading megabytes of data? The answer is the Merkle Tree (or binary hash tree).

In a Merkle tree:

  1. Every individual transaction is hashed: $H_A, H_B, H_C, H_D$.
  2. Pairs of transaction hashes are concatenated and hashed together: $H_{AB} = \text{Hash}(H_A + H_B)$ and $H_{CD} = \text{Hash}(H_C + H_D)$.
  3. This process repeats recursively until a single hash remains at the top: the Merkle Root.
                   [ Merkle Root (H_ABCD) ]
                          /          \
                 [ H_AB ]              [ H_CD ]
                 /      \              /      \
             [ H_A ]  [ H_B ]      [ H_C ]  [ H_D ]
                │        │            │        │
             [ Tx A ] [ Tx B ]     [ Tx C ] [ Tx D ]

Thanks to the Merkle tree, verifying whether Tx A exists in a block requires only a logarithmic number of hashes (the Merkle Proof), enabling efficient light-client verification on low-power devices.

What Constitutes a Transaction?

A blockchain transaction is a cryptographically authenticated state transition. In account-based models like Ethereum, a transaction looks similar to a bank transfer debiting an account balance. In UTXO-based models like Bitcoin, transactions consume Unspent Transaction Outputs and produce new outputs.

At minimum, a transaction contains:

  • Inputs: Proof of funds being spent, including previous transaction references and digital signatures.
  • Outputs: The destination public addresses and the amounts assigned to each recipient.
  • Transaction Fee: The tip paid to network node operators for processing the transaction.

Summary

  • Cryptographic hash functions provide one-way, collision-resistant mathematical fingerprints that guarantee data integrity.
  • Block headers bind chronological blocks together by embedding the hash of the preceding block.
  • Merkle trees condense thousands of transactions into a single root hash, enabling rapid cryptographic auditing.
Topics Covered:
#Cryptography#Hashing#Data Structures
Continue Learning

Related Guides

View all articles →