>

>

2. What's Inside a Block?

Decoding the Snapshot

Every block has a "fingerprint" and a "height."

The id is a unique hash that identifies the block, while the number tells you how high the chain has grown.

You'll also see a parentID—this is the hash of the block that came just before it, creating a secure chain!

"In JavaScript, this means..." you have two primary ways to ask for this data using the SDK:

  1. Compressed Block: Gives you the metadata and a simple list of transaction IDs.

    • Metaphor: Like reading the "Table of Contents" of a book.

  2. Expanded Block: Includes full transaction details, execution outputs, events, and fees.

    • Metaphor: Like reading every single page of the book.

// Lightweight query for metadata only
const compressed = await thor.blocks.getBlockCompressed(12345678);

// Deep query for full details and receipts
const expanded = await thor.blocks.getBlockExpanded(12345678);
// Lightweight query for metadata only
const compressed = await thor.blocks.getBlockCompressed(12345678);

// Deep query for full details and receipts
const expanded = await thor.blocks.getBlockExpanded(12345678);
// Lightweight query for metadata only
const compressed = await thor.blocks.getBlockCompressed(12345678);

// Deep query for full details and receipts
const expanded = await thor.blocks.getBlockExpanded(12345678);

Almost there! Most developers use compressed blocks for basic monitoring to save bandwidth and improve performance.