Skip to content

Package Library

Overview

Gossamer is a modular blockchain framework; it was designed with a package structure that makes it possible to reuse Gossamer packages to build and run custom nodes and node services.

This document provides an overview of the packages that make up the Gossamer framework - more detailed information about each package can be found at pkg.go.dev/ChainSafe/gossamer.

Gossamer packages can be categorized into four package types:

  • cmd packages

    • cmd/... - command-line packages for running nodes and other services
  • dot packages

    • dot/... - the dot node package and host node service packages
  • lib packages

    • lib/... - modular packages for building nodes and other services
  • test packages

    • tests/... - test packages for integration tests

cmd packages

cmd/gossamer

  • The gossamer package is used to run nodes built with Gossamer.

dot packages

dot

  • The dot package contains packages that implement the Polkadot Host spec. The dot package implements the Host Node; it is the base node implementation for all Official Nodes and Custom Services built with Gossamer.

dot/core

  • The core package implements the Core Service - responsible for block production and block finalisation (consensus) and processing messages received from the Network Service.

dot/network

  • The network package implements the Network Service - responsible for coordinating network host and peer interactions. It manages peer connections, receives and parses messages from connected peers and handles each message based on its type.

dot/state

  • The state package implements the State Service - the source of truth for all chain and node state that is made accessible to all node services.

dot/sync

  • The sync package implements handling of blocks received from the network layer.

dot/rpc

  • The rpc package implements the RPC Service - an HTTP server that handles state interactions.

dot/types

  • The types package implements types defined within the Polkadot Host specification.

lib packages

lib/babe

  • the babe package implements the BABE block production algorithm.

lib/blocktree

  • the blocktree package implements the blocktree, a data structure which tracks the chain and all its non-finalised forks.

lib/common

  • the common package defines common types and functions.

lib/crypto

  • the crypto package contains the key types used by the node (sr25519, ed25519, secp256k1).

lib/grandpa

  • the grandpa package implements the GRANDPA finality gadget.

lib/keystore

  • the keystore package manages the keystore and includes test keyrings.

lib/runtime

  • the runtime package contains various wasm interpreters used to interpret the runtime. It currently contains life and wasmer; however, wasmer is the only interpreter that is fully supported at the moment. In the future, all interpreters will be fully supported.

lib/services

  • the services package implements a common interface for node services.

lib/transaction

  • the transaction package contains transaction types and the transaction queue data structure.

lib/trie

  • the trie package implements a modified merkle-patricia trie.

lib/utils

  • the utils package is used to manage node and test directories.

test packages

tests/polkadotjs_test

  • the polkadotjs_test section is a node.js implementation to test interaction with Gossamer's RPC.

tests/rpc

  • the rpc test collection comprises tests to cover the RPC's various endpoints and return data.

tests/stress

  • the stress test collection comprises tests to simulate the node running under various high stress scenarios

tests/sync

  • the sync test collection comprises tests to verify the integrity of syncing operations and features

tests/utils

  • the utils test collection comprises tests to validate the function of various utilities throughout the Gossamer stack