Module bitcoin::network::encodable [] [src]

Consensus-encodable types

This is basically a replacement of the Encodable trait which does normalization for endianness, etc., to ensure that the encoding matches for endianness, etc., to ensure that the encoding matches the network consensus encoding.

Essentially, anything that must go on the -disk- or -network- must be encoded using the ConsensusEncodable trait, since this data must be the same for all systems. Any data going to the -user-, e.g. over JSONRPC, should use the ordinary Encodable trait. (This should also be the same across systems, of course, but has some critical differences from the network format, e.g. scripts come with an opcode decode, hashes are big-endian, numbers are typically big-endian decimals, etc.)

Structs

CheckedData

Data which must be preceded by a 4-byte checksum

VarInt

A variable-length unsigned integer

Traits

ConsensusDecodable

Data which can be encoded in a consensus-consistent way

ConsensusEncodable

Data which can be encoded in a consensus-consistent way