Credit Smart Chain
  • Overview
  • Get started
    • Installation
    • Local Setup
    • CLI Commands
    • JSON RPC Commands
  • RPC mainnet
  • Configuration
    • Server configuration file
    • Manage private keys
    • Enable Prometheus metrics
  • Working with a node
    • Query JSON RPC endpoints
    • Query operator information
    • Backup/restore node instance
  • Consensus
    • Proof of Stake
    • Set up and use Proof of Stake (PoS)
  • Additional features
    • Network stress testing
  • Architecture
    • Architecture Overview
    • Modules
      • Blockchain
      • Minimal
      • Networking
      • State
      • TxPool
      • JSON RPC
      • Consensus
      • Storage
      • Types
      • Protocol
      • Sealer
      • Other modules
  • Concepts
    • State in Ethereum
  • Community
    • Propose a new feature
    • Report an issue
Powered by GitBook
On this page
  • Overview​
  • RLP Encoding / Decoding​
  1. Architecture
  2. Modules

Types

PreviousStorageNextProtocol

Last updated 1 year ago

Overview

The Types module implements core object types, such as:

  • Address

  • Hash

  • Header

  • lots of helper functions

RLP Encoding / Decoding

Unlike clients such as GETH, the Credit Smart Chain 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 Credit Smart Chain doesn't need to use reflection. In rlp_marshal.go, you can find methods for marshaling:

  • Bodies

  • Blocks

  • Headers

  • Receipts

  • Logs

  • Transactions

​
​