Message Headers

All messages in the network protocol use the same container format, which provides a required multi-field message headermessage header - The four header fields prefixed to all messages on the Dash P2P network. and an optional payload. The message header format is:

BytesNameData TypeDescription
4start stringchar[4]Magic bytes indicating the originating network; used to seek to next message when stream state is unknown.
12command namechar[12]ASCII string which identifies what message type is contained in the payload. Followed by nulls (0x00) to pad out byte count; for example: version\0\0\0\0\0.
4payload sizeuint32_tNumber of bytes in payload. The current maximum number of bytes (MAX_SIZE) allowed in the payload by Dash Core is 32 MiB---messages with a payload size larger than this will be dropped or rejected.
4checksumchar[4]Added in protocol version 209.

First 4 bytes of SHA256(SHA256(payload)) in internal byte order.

If payload is empty, as in verack and getaddr messages, the checksum is always 0x5df6e0e2 (SHA256(SHA256())).

Example

The following example is an annotated hex dump of a mainnetmainnet - The original and main network for Dash transactions, where duffs have real economic value. message header from a verack message which has no payload.

bf0c6bbd ................... Start string: Mainnet
76657261636b000000000000 ... Command name: verack + null padding
00000000 ................... Byte count: 0
5df6e0e2 ................... Checksum: SHA256(SHA256(<empty>))

What’s Next
Did this page help you?