Blockchain Basics

Blocks in a blockchain

This is Blocks in a blockchain

Beginner Level30 minutesBy Pratima Sharma
Blocks in a blockchain
Block Structure

A block is the fundamental unit of data in a blockchain. Think of it as a container that securely stores a batch of information (usually transactions) and links it cryptographically to the previous block, forming a chain.

1. Block Structure (Typical Blockchain Example)

Although details vary between blockchain implementations (e.g., Bitcoin, Ethereum, Hyperledger), a block usually has these main components:

a) Block Header

The block header contains metadata that uniquely identifies the block and ensures security. It usually includes:

  • Block Number (Height): Position of the block in the chain.
    Example: Block #100 follows Block #99.
  • Previous Block Hash: A cryptographic hash of the previous block’s header.
    Ensures immutability — if Block #99 changes, its hash changes, making Block #100 invalid.
  • Merkle Root Hash: A hash of all transactions inside the block, organized in a Merkle Tree.
    Allows efficient verification of individual transactions.
  • Timestamp: The exact time the block was created.
    Example: 2025-08-17 14:35:27 UTC
  • Nonce: A random number used in Proof-of-Work consensus to satisfy difficulty requirements.
  • Difficulty Target: Defines how hard it is to mine a block.
  • Version: Indicates the blockchain software version.

Bitcoin Example:

  • Previous Block Hash = 0x000000...0 (none since it’s the first block)
  • Merkle Root = Hash of the only transaction (50 BTC reward to Satoshi)
  • Nonce = 2083236893
  • Timestamp = 2009-01-03 18:15:05 UTC

b) Block Body

The block body contains the actual data/transactions:

  • Transaction Counter → Number of transactions in this block.
  • Transactions → List of validated transactions, typically including:
    • Sender Address (Public Key)
    • Receiver Address (Public Key)
    • Amount
    • Digital Signature (to prove authenticity)
    • Smart Contract Code/Data (in platforms like Ethereum)

Ethereum Example:

  • Transactions (value transfers, contract deployments, smart contract function calls)
  • Gas usage and gas limits
  • State changes in the Ethereum Virtual Machine (EVM)

Example: If Alice sends 1 BTC to Bob, and Charlie sends 2 BTC to Diana, both transactions are stored in the block body.

Block #100:
Header:
- Previous Hash: 0000abc...xyz123
- Timestamp: 2025-08-17 14:35:27 UTC
- Nonce: 734562
- Merkle Root: a34f2c9...ef6721

Body:
Transactions:
1. Alice -> Bob (1 BTC)
2. Charlie -> Diana (2 BTC)
3. Eve -> Frank (0.5 BTC)
  

Here:
• The previous hash links Block #100 to Block #99.
• The Merkle root summarizes all transactions.
• The nonce proves that miners solved the cryptographic puzzle.

Bitcoin Example

  • Block size limit: ~1 MB
  • Average transactions per block: 2,000–3,000
  • Block time: ~10 minutes
  • Genesis Block (Block #0): Created by Satoshi Nakamoto in 2009

Summary:

  • A block = header + body
  • The header secures the block with cryptographic hashes
  • The body stores actual transaction data
  • Blocks are linked via hashes, forming a tamper-proof chain
  • Any modification in a block invalidates all following blocks

2. Cryptographic Linking Between Blocks

  • Each block has a hash of its header.
  • The next block includes this hash in its Previous Block Hash field.
  • This creates a tamper-proof chain: if anyone alters a past block, its hash changes, breaking the chain.

Example:

  • Block #100 has hash 0000a9d3...
  • Block #101 references that hash in its header.
  • If Block #100 changes, Block #101’s reference becomes invalid → consensus rejects it.

3. Example Walkthrough: Adding a Block (Bitcoin-like Chain)

  1. Transactions Created → Alice sends 1 BTC to Bob, signed with her private key.
  2. Transactions Verified → Nodes validate Alice’s balance, signature, and format.
  3. Block Formation → Transactions grouped into a block with:
    • Previous Block Hash
    • Merkle Root of all transactions
    • Timestamp, nonce, difficulty
  4. Proof of Work (Mining) → Miners try nonce values until the block’s hash meets difficulty (e.g., starts with 000000).
  5. Block Added → Block is appended to the chain.
  6. Network Agreement → Other nodes validate the block before accepting it.

Test Your Knowledge

Practice what you've learned with these quizzes related to What is Blockchain?.

Continue Learning

Explore more topics in What is Blockchain? or browse other tutorials.