TeachMeBitcoin

VOUT Serialization Hex

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

VOUT Serialization

Understanding how the VOUT index is written into the raw transaction data is essential for any developer building Bitcoin software. Like most numbers in the protocol, it follows the Little-Endian byte order.

1. Little-Endian Storage

In Little-Endian, the "least significant byte" comes first. This can make raw hex data look confusing to human eyes.

Example: VOUT 0

Example: VOUT 1

Example: VOUT 256

2. Placement in the Input

In a raw transaction hex, the VOUT always follows the 32-byte TXID.

[32 Bytes TXID][4 Bytes VOUT][VarInt ScriptLen]...

3. Why Little-Endian?

Bitcoin uses Little-Endian for most numeric values because it was originally developed for x86 processors, which use Little-Endian natively. This allows the computer to read the number directly into memory without performing a conversion.

4. Decoding Cheat Sheet

VOUT Index Hex (Protocol)
0 00 00 00 00
1 01 00 00 00
10 0a 00 00 00
Coinbase ff ff ff ff

In the next section, we will see how the Chainstate Database uses VOUT to track your coins.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!