Block Matrix
Menu

Reading Solana Account Data: Borsh Layouts and Heap Limits

What does an Anchor account’s stored data contain, and how can it be decoded? In a technical explainer published on November 16, 2026, the source uses Anchor’s #[account] macro to examine the Borsh serialization behind Solana account data.

The examples, UserProfile and DaoProposal, illustrate how a decoder must follow a known layout. The explainer breaks down an eight-byte account discriminator, u8 and u64 values, an Option flag, and u32 length prefixes for String and Vec fields. Borsh does not store field metadata alongside the values; its encoding is deterministic and uses little-endian byte order.

Layout matters for resource use as well as interpretation. The explainer notes that deserializing dynamic types can require heap allocation and consume compute units (CU). It identifies the 32 KB heap as a hard constraint for large data structures, setting up a subsequent discussion of zero-copy access. This is an explanation of serialization and its limits, not a measurement of a particular account’s contents or compute use.