# Bytes & numbers

> The groundwork for reading Pearl byte by byte: hexadecimal, bytes, byte order and CompactSize, with real mainnet data.

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

Before you can read a Pearl block or transaction, you need four small ideas about how computers write numbers down.

None of them is special to Pearl. They come straight from Bitcoin, unchanged. But they are everywhere: in every key, every hash, every amount and every header. Learn them once and the rest of the codex opens up.

## Why start with bytes?

Because that’s what Pearl really is underneath. A transaction isn’t a form with boxes. It’s a row of [bytes](https://pearlcodex.com/glossary/#byte), and the meaning comes from where each byte sits.

Here is the real header of block 130,825, all 108 bytes of it. By the end of this group you will be able to read every part: the version, the reversed hashes, the time and the bits.

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

```
00000020 d3221e43dc59c5d0dae1ee53987d6a4abeef42567d682017a6edd6e0de7ac7ab 2a051d25484d57e49a1f3b757685403ed06f558bb06a1804c34fac74ee7f5fab 8393d76a ebd06a17 ce6de312e0e4ca6c862c05835314db00cf02c13a20ea4810940f09b64ed8ba86
```

| 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  | abc77adee0d6eda61720687d5642efbe4a6a7d9853eee1dad0c559dc431e22d3 · Hash of the parent block, stored byte-reversed; shown in display order.                                  |
| Merkle root (`header.merkleRoot`)           | 32, offset 36 | ab5f7fee74ac4fc304186ab08b556fd03e408576753b1f9ae4574d48251d052a · Root of the SHA256d Merkle tree of this block’s txids, stored byte-reversed.                             |
| Time (`header.timestamp`)                   | 4, offset 68  | 1792512899 (2026-10-20 16:14:59 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  | 0x176ad0eb · Compact target. Difficulty 40,208,379.92. The certificate's jackpot hash (not this header's hash) must meet it.                                                |
| Proof commitment (`header.proofCommitment`) | 32, offset 76 | 86bad84eb6090f941048ea203ac102cf00db145383052c866ccae4e012e36dce · SHA256d(LE32(certificate version) ‖ public data). Replaces Bitcoin’s nonce: Pearl headers have no nonce. |

- **Block hash:** 3fc851763893a0135ea756d5dcbe355f375e613957930e7f401fafc8ee5533ae
- **Height:** 130,825
- **Time:** 2026-10-20 16:14:59 UTC
- **Difficulty:** 40,208,379.92

## What’s in this group?

Read these in order. Each one takes about five minutes.

| Page                                                                  | What you’ll learn                                                                        |
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [Hexadecimal](https://pearlcodex.com/technical/general/hexadecimal/)  | Why keys and hashes are written with 0–9 and a–f, and how to convert by hand.            |
| [Bytes](https://pearlcodex.com/technical/general/bytes/)              | What a byte holds, how big Pearl’s pieces are, and how negative numbers and text fit in. |
| [Byte order](https://pearlcodex.com/technical/general/byte-order/)    | Why numbers are stored “backwards” and why hashes are shown reversed.                    |
| [CompactSize](https://pearlcodex.com/technical/general/compact-size/) | The tiny length prefix in front of every list and script.                                |

> **Pearl vs Bitcoin: Same as Bitcoin**
>
> Hexadecimal, little-endian integers, reversed hash display and CompactSize all work exactly as in Bitcoin. If you already know them, skip ahead to [Cryptography](https://pearlcodex.com/technical/cryptography/) or [Matrix math](https://pearlcodex.com/technical/math/), where Pearl starts to differ.

## Where do these ideas show up in Pearl?

Everywhere, but a few places are worth knowing in advance:

- **Hashes** (block hashes, transaction IDs) are 32 bytes, shown as 64 hex characters, with their bytes reversed for display.
- **Amounts** are 8-byte little-endian whole numbers of grains. One PRL is 100,000,000 grains.
- **The header’s time and bits** are 4-byte little-endian numbers.
- **Every count and length** inside a transaction (inputs, outputs, scripts, witness items) is a CompactSize.
- **Pearl’s mining tickets** are BLAKE3 hashes read as little-endian 256-bit numbers, which is one of the few places where byte order decides who wins a block.

> **Tip**
>
> Keep the [hex converter](https://pearlcodex.com/tools/hex-converter/) open in another tab while you read the codex. Paste any value from a page and flip its byte order.

## In this group

1. [Hexadecimal](https://pearlcodex.com/technical/general/hexadecimal/): Counting in sixteens, two characters per byte
2. [Bytes](https://pearlcodex.com/technical/general/bytes/): Eight bits, one number from 0 to 255
3. [Byte order](https://pearlcodex.com/technical/general/byte-order/): Why Pearl’s numbers are stored backwards, and its hashes shown backwards
4. [CompactSize](https://pearlcodex.com/technical/general/compact-size/): A length that takes one byte, unless it really needs more

## In short

- Everything in Pearl, from a private key to a block, is stored as a row of bytes, and each byte is a number from 0 to 255.
- Hexadecimal writes each byte as exactly two characters, which is why keys and hashes look like long strings of 0–9 and a–f.
- Pearl stores multi-byte numbers smallest byte first (little-endian) and shows hashes with their bytes reversed, the same as Bitcoin.
- Counts and lengths use CompactSize: one byte for anything below 253, more bytes only when needed.
- With these four ideas you can read a raw Pearl header or transaction yourself.

## Read the code

- [Reading and writing CompactSize numbers](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/common.go#L500-L612) `node/wire/common.go:500-612`
- [Why hashes are shown 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`
- [Writing the 108-byte header field by field](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/wire/blockheader.go#L184-L215) `node/wire/blockheader.go:184-215`

## Sources

### Pearl source

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

### Other

- [learnmeabitcoin: Hexadecimal, Bytes, Byte Order, Compact Size (the Bitcoin versions of these pages)](https://learnmeabitcoin.com/technical/general/)
