arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Types

hashtag
Overview

The Types module implements core object types, such as:

  • Address

  • Hash

  • Header

  • lots of helper functions

hashtag
RLP Encoding / Decoding

Unlike clients such as GETH, the ZChains doesn't use reflection for the encoding. The preference was to not use reflection because it introduces new problems, such as performance degradation, and harder scaling.

The Types module provides an easy-to-use interface for RLP marshaling and unmarshalling, using the FastRLP package.

Marshaling is done through the MarshalRLPWith and MarshalRLPTo methods. The analogous methods exist for unmarshalling.

By manually defining these methods, the ZChains doesn't need to use reflection. In rlp_marshal.go, you can find methods for marshaling:

  • Bodies

  • Blocks

  • Headers

Receipts
  • Logs

  • Transactions