Skip to content

Block Header Binary Encoding

Lars Kuhtz edited this page Sep 10, 2019 · 30 revisions

BlockHeader Binary Format For Chain Graphs of Degree Three

defined in Chainweb.BlockHeader

Size Bytes Value
8 0-7 nonce
8 8-15 time
32 16-47 parent
110 48-157 adjacents
32 158-189 target
32 190-221 payload
4 222-225 chain
32 226-257 weight
8 258-265 height
4 266-269 version
8 270-277 epoch start
32 278-309 hash

total: 302 bytes

Adjacent Parents Record (length 3):

Bytes Value
0-1 length
2-107 adjacents

total: 110 bytes

Adjacent Parent:

Bytes Value
0-3 chain
4-35 hash

total: 36 bytes

Fields

POW related values:

Arithmetic operations and comparisons on parent, target, weight, and hash interpret the value as unsigned 256 bit integral numbers in little endian encoding.

Time Stamps:

time and epoch start are a little endian twoth complement encoded integral numbers that counts SI microseconds since POSIX epoch. These numbers are always positive (highest bit is 0).

Numbers:

  • height is a little endian encoded unsigned integral 64 bit number.
  • length is a little endian encoded unsigned integral 16 bit number.

Version:

version identifies the chainweb version. It is a 32 bit value in little endian encoding. Values up to 0x0000FFFF are reserved for production versions (which includes Development and testnets).

value version
0x00000001 Development
0x00000004 Testnet02

Other:

  • nonce is any sequence of 8 bytes that is only compared for equality.
  • chain is any sequence of 4 bytes that identifies a chain and can be compared for equality.
  • payload is any sequence of 32 bytes that is a cryptographic hash of the payload associated with the block and can be compared for equality.