Encoding & Layout
Cross-cutting serialization rules — optional types, Borsh vs bincode, and how rent ties to account size.
Borsh vs bincode
Encoding
The two dominant binary serializations on Solana. Borsh (Anchor, SPL, most app programs) and bincode (native System/Stake/Vote programs) differ in enum tag width and a few conventions — enough to break a decoder that assumes the wrong one.
Explore
COption vs Option vs OptionalNonZeroPubkey
Encoding
Solana has three different ways to encode an optional value, and they're not interchangeable. SPL's COption is 4 bytes of tag, Borsh's Option is 1, and Token-2022's OptionalNonZeroPubkey is 0 — the single most common source of off-by-N decoder bugs.
Explore
Rent & Account Size
Encoding
Why every Solana account has a fixed byte size set at creation and a minimum SOL balance to stay alive. Rent exemption is a deposit proportional to size — refundable when the account closes.
Explore