# Previous block

> The previous-block field: the parent's hash, stored byte-reversed. How it chains blocks, why rewriting history means redoing work, and why mining needs it.

Source: https://pearlcodex.com/technical/block/previous-block/ · Last updated: 2026-10-20 · Checked against Pearl's source code at v1.5.5

Every block points back at the block before it. The pointer is the parent’s [block hash](https://pearlcodex.com/glossary/#block-hash), written into the second field of the header.

That’s the whole trick behind a blockchain. Each block names its parent by a fingerprint of the parent’s header. The parent names its own parent, and so on, all the way back to the [genesis block](https://pearlcodex.com/glossary/#genesis-block). Change any old block and its fingerprint changes, and every link after it breaks.

## Try it

Edit a block in the middle of a short chain and watch every later block turn invalid.

_Interactive: A chain of blocks. Try it on the page: <https://pearlcodex.com/technical/block/previous-block/>_

## What does it look like?

- **Size:** 32 bytes
- **Type:** SHA256d hash of the parent's header
- **Format:** Internal byte order (shown reversed)

**Block 130,827 · header · 108 bytes**

```
00000020 999c961b04d94b8b21134e862dc31d5fa56cf9d1f027adb2a0cf95c6525c55eb 6389faa36bd9daffdefc800dea88ac3ef5af1198f7d7179ef3b904420c1cc2c6 1a96d76a a6f36a17 4d52a3fd32160cb032e22edf76912f67dfb1b88946a215281f203836c77ae649
```

| Field                                       | Bytes         | Value                                                                                                                                                                       |
| ------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`header.version`)                  | 4, offset 0   | 0x20000000 · int32 LE. BIP-9 style 0x20000000 since block 1; no consensus meaning in Pearl.                                                                                 |
| Previous block (`header.prevBlock`)         | 32, offset 4  | eb555c52c695cfa0b2ad27f0d1f96ca55f1dc32d864e13218b4bd9041b969c99 · Hash of the parent block, stored byte-reversed; shown in display order.                                  |
| Merkle root (`header.merkleRoot`)           | 32, offset 36 | c6c21c0c4204b9f39e17d7f79811aff53eac88ea0d80fcdeffdad96ba3fa8963 · Root of the SHA256d Merkle tree of this block’s txids, stored byte-reversed.                             |
| Time (`header.timestamp`)                   | 4, offset 68  | 1792513562 (2026-10-20 16:26:02 UTC) · uint32 LE Unix seconds. Must be at least 1 s after the parent and at most 5 min in the future.                                       |
| Bits (`header.bits`)                        | 4, offset 72  | 0x176af3a6 · Compact target. Difficulty 40,157,376.49. The certificate's jackpot hash (not this header's hash) must meet it.                                                |
| Proof commitment (`header.proofCommitment`) | 32, offset 76 | 49e67ac73638201f2815a24689b8b1df672f9176df2ee232b00c1632fda3524d · SHA256d(LE32(certificate version) ‖ public data). Replaces Bitcoin’s nonce: Pearl headers have no nonce. |

- **Block hash:** 1df2f2c1bf39b1a444e622c1788c11736da2f91f4e9a875a38dc23063c6d45b9
- **Height:** 130,827
- **Time:** 2026-10-20 16:26:02 UTC
- **Difficulty:** 40,157,376.49

Bytes 4 to 35 of block 130,827’s header are:

```text
999c961b04d94b8b21134e862dc31d5fa56cf9d1f027adb2a0cf95c6525c55eb
```

Reverse them byte by byte and you get the hash of block 130,826, as any explorer shows it:

`eb555c52c695cfa0b2ad27f0d1f96ca55f1dc32d864e13218b4bd9041b969c99`

## Why is it stored backwards?

It isn’t, quite. A hash comes out of SHA-256 as 32 bytes in a fixed order, and that’s the order the header stores. This is the _internal_ byte order.

When Bitcoin’s software prints a hash, it reverses the bytes, treating the hash as one big [little-endian](https://pearlcodex.com/glossary/#little-endian) number written the usual way, biggest digit first. Pearl inherited that habit unchanged, so every block hash and transaction ID you see on an explorer is the reverse of the bytes on the wire. See [byte order](https://pearlcodex.com/technical/general/byte-order/).

**Going deeper: A habit that lost its reason**

In Bitcoin, reading the hash as a little-endian number is what the proof-of-work check does, so the reversed display puts a winning hash’s zeros at the front where people can see them. Pearl never compares the block hash with the target, so its block hashes have no leading zeros to show. The reversal is now pure convention.

## Where does the chain start?

At genesis, which has no parent. Its previous-block field is 32 zero bytes.

Block 1 is the first real link. Its previous-block field holds the genesis hash, stored reversed:

**Block 1 · header · 108 bytes**

```
00000020 d7ad8dc5415fb548ff53efe75f10e0e27403d1a33f07dd0c8f61ffb793308da1 e20b5690eded4b6cd7e80d254be73741c6454990881d954911b7a6fb268bb136 9125ef69 ffff001b a6702c7bc69f78c1889ee018904bc9389ee6a71dd55865d263b1c469359088f0
```

| Field                                       | Bytes         | Value                                                                                                                                                                       |
| ------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`header.version`)                  | 4, offset 0   | 0x20000000 · int32 LE. BIP-9 style 0x20000000 since block 1; no consensus meaning in Pearl.                                                                                 |
| Previous block (`header.prevBlock`)         | 32, offset 4  | a18d3093b7ff618f0cdd073fa3d10374e2e0105fe7ef53ff48b55f41c58dadd7 · Hash of the parent block, stored byte-reversed; shown in display order.                                  |
| Merkle root (`header.merkleRoot`)           | 32, offset 36 | 36b18b26fba6b71149951d88904945c64137e74b250de8d76c4beded90560be2 · Root of the SHA256d Merkle tree of this block’s txids, stored byte-reversed.                             |
| Time (`header.timestamp`)                   | 4, offset 68  | 1777280401 (2026-04-27 09:00:01 UTC) · uint32 LE Unix seconds. Must be at least 1 s after the parent and at most 5 min in the future.                                       |
| Bits (`header.bits`)                        | 4, offset 72  | 0x1b00ffff · Compact target. Difficulty 1.00. The certificate's jackpot hash (not this header's hash) must meet it.                                                         |
| Proof commitment (`header.proofCommitment`) | 32, offset 76 | f088903569c4b163d26558d51da7e69e38c94b9018e09e88c1789fc67b2c70a6 · SHA256d(LE32(certificate version) ‖ public data). Replaces Bitcoin’s nonce: Pearl headers have no nonce. |

- **Block hash:** a09851a4761539d170f7dfe7531864ae92879b02bbe999a6c238f63745a69726
- **Height:** 1
- **Time:** 2026-04-27 09:00:01 UTC
- **Difficulty:** 1

|                | Bytes in block 1’s header | Displayed                                                                            |
| -------------- | ------------------------- | ------------------------------------------------------------------------------------ |
| Previous block | `d7ad8dc5…93308da1`       | `a18d3093b7ff618f0cdd073fa3d10374e2e0105fe7ef53ff48b55f41c58dadd7`, the genesis hash |

## What does the link protect?

Everything before it. Here is the chain of consequences if someone edits one transaction in an old block:

1. **The old block's Merkle root changes**

   The transaction’s ID changes, so the [Merkle root](https://pearlcodex.com/technical/block/merkle-root/) in that block’s header changes.

2. **So its block hash changes**

   The block hash is SHA256d of all 108 header bytes, Merkle root included.

3. **So the next block's link is broken**

   The next block’s previous-block field still holds the old hash. To fix it, that header must change too, which changes its hash, which breaks the block after it.

4. **So every later block needs new mining work**

   Each rewritten header needs a valid [certificate](https://pearlcodex.com/technical/block/certificate/), and a certificate is bound to its header’s first 76 bytes, previous block included. The attacker must redo the mining work of every block up to the tip, faster than the honest network adds new ones.

On Pearl the links cover more than in Bitcoin. A Pearl header ends with a [proof commitment](https://pearlcodex.com/technical/block/proof-commitment/), a hash of the certificate’s public data. So the chain of block hashes also chains every winning ticket since genesis.

## Can a block’s parent be any block?

The parent must be a block the node already knows, and the new block’s [height](https://pearlcodex.com/glossary/#height) is the parent’s plus one. Two blocks can share a parent; that’s a fork, and nodes follow the chain with the most work, as in Bitcoin, with one Pearl twist (a switch needs a small extra margin of work). See [the most-work chain](https://pearlcodex.com/technical/blockchain/most-work-chain/).

Pearl’s nodes also carry [checkpoints](https://pearlcodex.com/glossary/#checkpoint), one every 10,000 blocks, and refuse any fork that branches off below the latest one (block 120,000 in v1.5.5).

## Why does mining care about the parent?

Because the previous block is part of the mining puzzle itself. A Pearl miner hashes the first 76 bytes of its block template (version, previous block, Merkle root, time and bits) together with its mining settings into a [job key](https://pearlcodex.com/glossary/#job-key). All the puzzle’s randomness flows from that key: the [noise seeds](https://pearlcodex.com/glossary/#noise-seed), the noise, and therefore every lottery ticket. See [noise seeds](https://pearlcodex.com/technical/mining/noise-seeds/).

**Make a guess:** A new block arrives while your GPU is half-way through a huge multiplication for the next one. What happens to the work done so far?

**Answer:** It’s thrown away.

The new block becomes your new parent. Your template’s previous-block field changes, so the job key changes, so the noise changes, so every ticket you’d produce from here on is different. Tickets already checked against the old template can’t be moved over. Mining restarts on the new tip, just as a Bitcoin miner restarts its nonce search.

> **Pearl vs Bitcoin: Same as Bitcoin**
>
> The field, its size, its byte order and the rule that it must name a known block are all Bitcoin’s. What differs is the hash it holds: SHA256d of a 108-byte header that ends with a proof commitment, instead of an 80-byte header that ends with a nonce.

**Code: the field, and how it reaches the prover**

The field is `PrevBlock chainhash.Hash` in [`BlockHeader`](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/blockheader.go#L21-L41), written as raw bytes. Printing a hash reverses it, in [`Hash.String()`](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/chaincfg/chainhash/hash.go#L73-L80):

`node/chaincfg/chainhash/hash.go`

```go
func (hash Hash) String() string {
	for i := 0; i < HashSize/2; i++ {
		hash[i], hash[HashSize-1-i] = hash[HashSize-1-i], hash[i]
	}
	return hex.EncodeToString(hash[:])
}
```

When a node verifies a certificate, it hands the Rust verifier its own copy of the first five fields, in [`blockHeaderToC`](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/zkpow/verify.go#L222-L238). The copy holds the two hashes in display order, and the Rust side reverses them back when it serializes, so the job key hashes exactly the header’s first 76 bytes. A certificate made for one parent fails against any other.

## In short

- Every header holds the hash of its parent’s header in its second field, 32 bytes long. That reference is what makes the blocks a chain.
- The hash is stored in internal byte order and shown reversed, as in Bitcoin: block 130,827 stores 999c961b…525c55eb, which displays as eb555c52…1b969c99, the hash of block 130,826.
- Changing anything in an old block changes its hash, which breaks the next block’s link, and so on to the tip. Rewriting history means redoing the mining work of every block after it.
- On Pearl the previous block also feeds the mining job key, so all matrix work is tied to one parent. Work done on an old tip is worthless on a new one.

## Read the code

- [PrevBlock in the BlockHeader struct](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/blockheader.go#L21-L41) `node/wire/blockheader.go:21-41`
- [Hashes are displayed byte-reversed](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/chaincfg/chainhash/hash.go#L73-L80) `node/chaincfg/chainhash/hash.go:73-80`
- [The job key hashes the first 76 header bytes](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/zk-pow/src/api/proof_utils.rs#L348-L353) `zk-pow/src/api/proof_utils.rs:348-353`
- [The header copy a node hands to the zero-knowledge verifier](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/zkpow/verify.go#L222-L238) `node/zkpow/verify.go:222-238`

## Sources

### Pearl source

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

### Chain data

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

### Other

- [Bitcoin whitepaper, §3–4 (timestamp server, proof of work)](https://bitcoin.org/bitcoin.pdf)
