EVMTools

RLP Encoder / Decoder

Encode and decode Recursive Length Prefix (RLP) data. The serialization format used by Ethereum transactions and blocks.

Examples

RLP Encoding Rules

  • 0x00-0x7f - Single byte: encoded as itself
  • 0x80-0xb7 - String 0-55 bytes: 0x80 + length, then data
  • 0xb8-0xbf - String >55 bytes: 0xb7 + length-of-length, length, then data
  • 0xc0-0xf7 - List 0-55 bytes payload: 0xc0 + length, then items
  • 0xf8-0xff - List >55 bytes payload: 0xf7 + length-of-length, length, then items