# Blocks and the chain

> Transactions are recorded in blocks. Each block names the one before it by its hash, so rewriting old history means redoing everything after it.

Source: https://pearlcodex.com/beginners/blocks-and-the-chain/ · Last updated: 2026-10-20 · Checked against Pearl's source code at v1.5.5

Transactions don’t enter the ledger one at a time. They’re collected into batches, and each batch is a [block](https://pearlcodex.com/glossary/#block).

On Pearl, a new block arrives roughly every 194 seconds. Each one is like a new page glued to the end of a book, and the glue is what makes the history so hard to change.

## What is in a block?

Three parts, in this order.

_A Pearl block, simplified. The certificate travels in front of the header; the transactions follow\._

The **certificate** is the proof that the miner did the required work. It’s about 60 kilobytes, and a later page explains what’s inside.

The **transactions** are the payments, starting with a special one, the [coinbase transaction](https://pearlcodex.com/glossary/#coinbase), which pays the miner.

The **header** is the block’s summary card. At 108 bytes, it’s tiny, and it holds six things:

1. **Version**: a number inherited from Bitcoin for signaling upgrades. Pearl’s rules don’t currently depend on it.
2. **Previous block**: the fingerprint of the block before this one.
3. **Merkle root**: one fingerprint that covers every transaction in the block.
4. **Time**: when the miner says the block was made.
5. **Bits**: the difficulty target, written in a compact form.
6. **Proof commitment**: a fingerprint of the certificate’s public part, which ties the mining work to this exact header.

Fingerprints keep coming up. Time to say what they are.

## What is a hash?

A [hash](https://pearlcodex.com/glossary/#hash) is a fingerprint of some data, made by a [hash function](https://pearlcodex.com/glossary/#hash-function). Pearl’s block fingerprints use [SHA256d](https://pearlcodex.com/glossary/#sha256d), which is the SHA-256 function applied twice.

A good hash function has three properties:

- The same input always gives the same hash.
- Change the input even slightly, and the hash changes completely.
- You can’t work backwards from a hash to the input.

Try it. Type anything below, then change a single letter and watch the whole fingerprint change.

_Interactive: Hash playground. Try it on the page: <https://pearlcodex.com/beginners/blocks-and-the-chain/>_

The [Merkle root](https://pearlcodex.com/glossary/#merkle-root) uses the same trick on a larger scale. The transactions are hashed in pairs, then the pair-hashes are hashed in pairs, and so on, until a single hash is left at the top. Change any transaction and the root changes.

## How do blocks link together?

Each header holds the hash of the previous block. The [block hash](https://pearlcodex.com/glossary/#block-hash) itself, the block’s ID, is simply the hash of its 108-byte header.

So every block points back to its parent, and that one to its parent, all the way to the very first block. That’s the chain in [blockchain](https://pearlcodex.com/glossary/#blockchain).

_Each header carries the previous block’s hash, so the blocks form a chain. Simplified: real hashes are 64 hex characters._

## Why is rewriting history so hard?

Suppose someone wants to erase a payment they made last week. They edit the transaction in its old block. Here’s what follows:

1. **The Merkle root changes**

   The edited transaction has a new hash, so the root over all the block’s transactions changes too.

2. **The block hash changes**

   The root sits in the header, so the header’s hash changes. The block now has a new ID.

3. **The next block no longer matches**

   Its “previous block” field still holds the old ID. The link is broken, and so is every link after it.

4. **Everything after must be redone**

   To repair the chain, the cheater must rebuild every later block, including all the mining work, and catch up with the rest of the network while it keeps adding new blocks.

That last step is what makes it hopeless. The honest network keeps mining, so the cheater has to out-work everyone else combined just to draw level.

**Make a guess:** Someone changes one transaction in block 100,000. Which blocks stop fitting into the chain?

**Answer:** Block 100,000 and every block after it.

The change gives block 100,000 a new hash. Block 100,001 still points to the old one, so it no longer fits, and neither does anything built on it. Every honest node just keeps its original copy.

## What is a confirmation?

When your payment lands in a block, it has one [confirmation](https://pearlcodex.com/glossary/#confirmation). Each block added on top adds one more.

More confirmations mean more work stacked on top of your payment, so it’s harder to undo. For a small payment, one or two may be plenty. For a large one, people often wait for more.

## What if two miners find a block at once?

It happens. Two miners each find a valid block at about the same moment, and for a short while the network has two competing versions of the newest page.

Nodes resolve it by following the branch with the most total work behind it. As soon as one branch gets another block on top, everyone switches to it. The losing block is dropped, its transactions go back to waiting, and they usually make it into the next block anyway.

This is why newly mined coins must wait 100 blocks before they can be spent: in case their block is the one that gets dropped.

## Where did the chain begin?

Every chain needs a first block, the [genesis block](https://pearlcodex.com/glossary/#genesis-block). Pearl’s is dated 27 April 2026, 09:00 UTC.

It paid no reward at all. Its built-in message quotes the hash of Bitcoin block 946,842, which was mined only hours earlier, as proof that Pearl’s history couldn’t have been prepared in advance.

Pearl’s software also has a few block hashes built in along the way, called checkpoints, one every 10,000 blocks up to block 120,000. A node refuses any history that disagrees with them.

> **Pearl vs Bitcoin**
>
> - Pearl’s header is 108 bytes, not 80. It has no nonce; its last 32 bytes are the proof commitment.
> - Pearl block hashes don’t start with zeros. The block hash is never compared with the target; the certificate carries the proof of work.
> - A raw Pearl block starts with the certificate, then the header, then the transactions.
> - Switching to a competing branch needs a lead of at least a quarter of a block’s work, not just any lead.

So blocks lock payments in place, and the chain makes the past expensive to change. But who gets to write each new block? That’s mining, and it’s next.

## In short

- A block is a batch of transactions plus a 108-byte header, with a mining certificate of about 60 KB travelling in front of it.
- A hash is a fingerprint of data. Change one character and the fingerprint changes completely.
- Each header contains the previous block’s hash, so the blocks form a chain.
- Changing an old transaction changes that block’s hash and breaks every later link, so a cheater would have to redo all the work since.
- Each block added on top of yours is one more confirmation, making your payment harder to undo.

## Read the code

- [The 108-byte header and the block hash](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/blockheader.go#L14-L48) `node/wire/blockheader.go:14-48`
- [A block on the wire, certificate first](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/msgblock.go#L87-L124) `node/wire/msgblock.go:87-124`
- [Building the Merkle root](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/merkle.go#L62-L185) `node/blockchain/merkle.go:62-185`
- [The genesis block](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/chaincfg/genesis.go#L59-L102) `node/chaincfg/genesis.go:59-102`

## Sources

### Pearl source

- [Pearl source code at v1.5.5](https://github.com/pearl-research-labs/pearl/tree/v1.5.5)

### Pearl docs

- [Pearl INT whitepaper (section 5, the header)](https://pearlresearch.ai/research/int-whitepaper)

### Chain data

- [Pearl Blockbook explorer](https://blockbook.pearlresearch.ai)
