There are two serialization methods designed for Ethereum – Recursive-length prefix (RLP) and the newer Simple Serialize (SSZ). The problem they are trying to solve, a short overview of the format, and some other thoughts.

The problem: data needs to be encoded/decoded over the wire, but also for hash verification (a transaction is signed by signing the RLP hash of the transaction data, blocks are identified by the RLP hash of their header). Additionally, for some cases, there should be support for efficient encoding of the merkle tree data structure.

The properties needed by the serialization format are:

A brief introduction to Recursive-length Prefix (RLP):

There are two encodable structures: a string (i.e., a byte array) and a list (of byte arrays).

The rules:

On Simple Serialize (SSZ),

SSZ is new in Ethereum 2.0 and replaces RLP as the encoding for the new consensus layer. It requires a schema to be known by both parties ahead of time. Integers (only unsigned) and booleans are converted to little-endian bytes. "Composite" types that are fixed size are encoded as the concatenation of their bytestrings. Variable type containers specify an offset, and the actual data is stored on a heap at the end of the fixed-length schema.

You can read the full spec here.

Some thoughts: