A block in a blockchain is a container that holds a batch of transactions plus a small header, and each block points to the one before it by storing that block's hash. A hash is a fixed-length fingerprint of some data. Linking blocks by hashes forms a chain, and that is why changing an old block breaks every block after it.
This guide explains what a block in blockchain contains, how the chain is formed and how hashes make the record tamper evident.
Every block has two main parts: a header and a body. The body holds the list of transactions, such as payments or contract calls. The header holds the information needed to check and order the block.
Typical header fields include:
Exact fields differ between networks. Bitcoin, Ethereum and others each define their own header layout, but the idea of header plus transactions is the same.
A hash function takes any input and produces a fixed-size output. A good cryptographic hash function such as SHA-256 has these properties:
You can see the second property with Python's standard library.
The two outputs share nothing in common, even though the inputs differ by one character. Each output is 64 hexadecimal characters long because SHA-256 always produces 256 bits.
Each block stores the hash of the previous block's header. That stored hash is the link. Block 3 contains the fingerprint of block 2, and block 2 contains the fingerprint of block 1. The first block of a chain is called the genesis block and has no real predecessor.
Because a block's own hash is computed from its contents, including the previous hash, the hashes depend on each other all the way back to the start.
The following example builds three blocks and checks the links.
The first check passes. After block 1 is edited, its hash changes, so block 2 no longer matches the hash it stored, and the chain is reported as invalid.
To hide an edit in an old block, an attacker would have to recompute that block's hash and the hash stored in every later block. On a real network that is not enough, because the changed chain must also be accepted by the other nodes. In proof of work systems the attacker would have to redo the mining work for every block after the change, faster than the honest network adds new ones. This is why older blocks are considered more final than new ones.
Blocks are not unlimited. Each network limits how much data a block can hold and aims for a target time between blocks. These are design choices, not universal rules, and they differ by network.
A transaction is first included in a block, which counts as one confirmation. Each further block added on top gives another confirmation. More confirmations mean a lower chance that the block will ever be replaced.
It is the very first block of a blockchain. It has no previous block, so its previous hash field is a fixed placeholder value.
A block's own hash is normally computed from its header and then stored in the next block, not inside itself. Some software also caches it next to the block for convenience.
In theory yes, but with a strong function like SHA-256 finding such a pair is considered infeasible with current technology.
No single rule applies. Each client stores blocks in its own format, often in a database, but all nodes must agree on the block contents.
A block groups transactions under a header, and each header carries the hash of the previous block. Because a hash changes completely when its input changes, editing any old block breaks every later link. That chain of hashes is what makes a blockchain tamper evident and gives older blocks their strong finality.