> ## Content Index
> Fetch the complete content index at: https://blog.chainsafe.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Gossamer: Into the Polkadot-verse Pt. 3
- URL: https://blog.chainsafe.io/gossamer-into-the-polkadot-verse-pt-3/
- Published: 2021-10-18T10:03:26.000Z
- Updated: 2026-05-08T23:23:23.000Z
- Author: ChainSafe Systems
- Tags: Polkadot, #Import 2023-11-01 00:46, #Import 2026-11-04 06:17

Authored by **Dan Forbes**

### Exploring SCALE refactors in Go, chain sync algorithms, and peer scoring in Gossamer

*For those who are unfamiliar, Gossamer 🕸 ️ is an implementation of the Polkadot Host, formerly known as the Polkadot Runtime Environment. To learn more about what exactly that is, watch our introductory talk from [DotCon during Berlin Blockchain Week](https://www.google.com/url?q=https://www.youtube.com/watch?v%3DnYkbYhM5Yfk&sa=D&source=editors&ust=1634079303581000&usg=AOvVaw2HSYR42mjIa9S7QmLm0flZ). Amer Ameen's [blog post](https://medium.com/chainsafe-systems/the-future-of-polkadot-in-golang-gossamer-3345f0d6143d?ref=blog.chainsafe.io) introducing Gossamer is also a neat summary of the vision behind our implementation. Dig into the code \[[here](https://chainsafe.github.io/gossamer/?ref=blog.chainsafe.io)\]([https://github.com/ChainSafe/gossamer](https://github.com/ChainSafe/gossamer?ref=blog.chainsafe.io)), read the docs here, and join in the conversation on the #Gossamer-general channel on our [Discord](https://discord.gg/CprJHjrWG6?ref=blog.chainsafe.io).*

It's been a few months since \[the last [Go](https://golang.org/?ref=blog.chainsafe.io)ssamer update\]([https://medium.com/chainsafe-systems/gossamer-into-the-polkdot-verse-pt-2-aeb83e2add74](https://medium.com/chainsafe-systems/gossamer-into-the-polkdot-verse-pt-2-aeb83e2add74?ref=blog.chainsafe.io)), and we're excited to be back again with more news about the development of the Go host for the [Polkadot Network](https://polkadot.network/?ref=blog.chainsafe.io) that we are building at [ChainSafe](https://chainsafe.io/?ref=blog.chainsafe.io) 💪 Keep reading to learn more about the SCALE refactor that we mentioned in our last update, as well as the other enhancements we've been working on to prepare for full participation in the Polkadot Network 🚀

![](https://miro.medium.com/0*ihj4vyn3etv0pM97)

## SCALE Codec Refactor

A codec is a protocol that can be used to encode and decode data for purposes like message-passing and serialization to disk. [Polkadot specifies a purpose-built codec](https://wiki.polkadot.network/docs/build-protocol-info?ref=blog.chainsafe.io#encoding) called [SCALE](https://substrate.dev/docs/en/knowledgebase/advanced/codec?ref=blog.chainsafe.io): the Simple Concatenated Aggregate Little-Endian Codec. Because of the pervasiveness of SCALE in Polkadot [Host](https://research.web3.foundation/en/latest/polkadot/specifications/host.html?ref=blog.chainsafe.io) implementations such as Gossamer, it's critical for Polkadot implementers to create SCALE libraries that are ergonomic and performance-preserving 🤸

Gossamer Team Lead Timothy Wu ([@timwu20 on GitHub](https://github.com/timwu20?ref=blog.chainsafe.io)) recently led the design and implementation of [an enhanced SCALE package](https://github.com/ChainSafe/gossamer/pull/1548?ref=blog.chainsafe.io) for Gossamer that increases the package's ergonomics by relying on idiomatic Go practices like [Marshal](https://github.com/ChainSafe/gossamer/blob/51cfcd7c2dc288afcd4807d5b6e3108d54d48273/pkg/scale/encode.go?ref=blog.chainsafe.io)/[Unmarshal](https://github.com/ChainSafe/gossamer/blob/51cfcd7c2dc288afcd4807d5b6e3108d54d48273/pkg/scale/decode.go?ref=blog.chainsafe.io) interfaces, and [struct tags](https://github.com/ChainSafe/gossamer/blob/51cfcd7c2dc288afcd4807d5b6e3108d54d48273/pkg/scale/scale.go?ref=blog.chainsafe.io#L45). Tim worked with Gossamer Engineer [@jimjbrettj](https://github.com/jimjbrettj?ref=blog.chainsafe.io) to [integrate the new SCALE package into the Gossamer codebase](https://github.com/ChainSafe/gossamer/issues/1621?ref=blog.chainsafe.io).

Check out [the excellent documentation](https://github.com/ChainSafe/gossamer/blob/51cfcd7c2dc288afcd4807d5b6e3108d54d48273/pkg/scale/README.md?ref=blog.chainsafe.io) for Gossamer's SCALE package to learn more! The Gossamer team is keeping a close eye on the development of [generics in Go](https://bitfieldconsulting.com/golang/generics?ref=blog.chainsafe.io) to ensure that our SCALE implementation is making use of the most cutting-edge developments in the Go language in order to ensure the aforementioned values of ergonomics and performance 🤓

## Chain Synchronization

The highlight of our last update was that Gossamer nodes were [fully synchronized with the Polkadot Network](https://twitter.com/ChainSafeth/status/1382476973235048451?ref=blog.chainsafe.io) 👯 In this update, we're happy to tell you about all the *improvements* we've been making to Gossamer's chain synchronization algorithms! The chain synchronization enhancements were designed and implemented by Elizabeth (AKA [@noot on GitHub](https://github.com/noot?ref=blog.chainsafe.io)), Head of Protocol Engineering at ChainSafe.

The [initial goals](https://github.com/ChainSafe/gossamer/issues/1659?ref=blog.chainsafe.io) of these changes were to make the Gossamer code more modular and maintainable by decoupling the network and sync packages, as well as to address [the issues](https://github.com/ChainSafe/gossamer/issues/1659?ref=blog.chainsafe.io#issuecomment-910372466) that were discovered with the initial implementation. Check out the excellent [design document](https://github.com/ChainSafe/gossamer/discussions/1778?ref=blog.chainsafe.io) 🔍 to learn more about the goals of the improvements and the decisions that were made in order to achieve them. In particular, the document encapsulates research into three existing blockchain synchronization algorithms: [Substrate](https://github.com/paritytech/substrate/blob/v3.0.0/client/network/src/protocol/sync.rs?ref=blog.chainsafe.io), [Parity's](https://www.parity.io/?ref=blog.chainsafe.io) [Rust blockchain framework](https://substrate.dev/docs/en/?ref=blog.chainsafe.io) that is used for their production chains like [Polkadot](https://github.com/paritytech/polkadot?ref=blog.chainsafe.io) and [Statemint](https://github.com/paritytech/cumulus/tree/statemine%5Fv3/polkadot-parachains/statemint?ref=blog.chainsafe.io); [smoldot](https://github.com/paritytech/smoldot/tree/main/src/sync?ref=blog.chainsafe.io), a lightweight, alternative Rust implementation of a client for the Polkadot Network; and [Lotus](https://github.com/filecoin-project/lotus/blob/v1.12.0-rc1/chain/sync%5Fmanager.go?ref=blog.chainsafe.io), the official, Go implementation of the [Filecoin](https://filecoin.io/?ref=blog.chainsafe.io) protocol for decentralized storage.

![](https://miro.medium.com/0*A4zc7sG2XCZbHTPY)

## Peer Scoring

In a decentralized network like Polkadot, "peer scoring" refers to the process that a network participant uses to prioritize the other clients that it will work with to power the network; the criteria that go into such an algorithm may include factors like responsiveness and correctness ✅

Gossamer Software Engineer Arijit Das ([@arjitAD on GitHub](https://github.com/arijitAD?ref=blog.chainsafe.io)) [designed](https://hackmd.io/@FyilpQ7sQ265a9xyqSxyLg/B1EIbIIfY?ref=blog.chainsafe.io) Gossamer's peer scoring algorithms by modeling them after those of [Substrate](https://github.com/paritytech/substrate?ref=blog.chainsafe.io), the Rust blockchain development framework that [Parity Technologies](https://www.parity.io/?ref=blog.chainsafe.io) maintains and is using to implement [the Polkadot Network](https://github.com/paritytech/polkadot?ref=blog.chainsafe.io) and even [parachains](https://github.com/paritytech/cumulus/tree/master/polkadot-parachains?ref=blog.chainsafe.io) like [Statemint](https://www.parity.io/blog/statemint-generic-assets-chain-proposing-a-common-good-parachain-to-polkadot-governance/?ref=blog.chainsafe.io).

The previous section described how Gossamer's networking and syncing concerns were recently decoupled; similarly, Gossamer's peer scoring capabilities were implemented in a new peerset package that interacts mostly with the capabilities of the network package - design decisions such as this help keep the Gossamer code base modular and maintainable 🛠 ️

![](https://miro.medium.com/0*eCAX7UBi7nBM2zWE)

## Other Updates

In our last update, we were excited to announce that we had achieved a full sync with the Polkadot Network - so what's next? Our next goal is to enable Gossamer clients to participate in the Polkadot Network as [authority nodes](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary?ref=blog.chainsafe.io#authority) 👮 This goal requires implementation of the Polkadot Host and [JSON-RPC APIs](https://github.com/ChainSafe/gossamer/issues/265?ref=blog.chainsafe.io). The [Host APIs](https://github.com/ChainSafe/gossamer/issues/1688?ref=blog.chainsafe.io) are the [native Go functions that are invoked by Polkadot's WebAssembly runtime](https://docs.wasmer.io/integrations/examples/host-functions?ref=blog.chainsafe.io), which provide capabilities like storage management 💾 The JSON-RPC APIs are [the interfaces](https://polkadot.js.org/docs/substrate/rpc?ref=blog.chainsafe.io) that are consumed by user-facing applications like the [Polkadot-JS Apps UI](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io&ref=blog.chainsafe.io#/explorer). The implementation of Gossamer's host and runtime APIs are being implemented by Edward Mack ([@edwardmack on GitHub](https://github.com/edwardmack?ref=blog.chainsafe.io)) and Eclésio Melo ([@EclesioMeloJunior on GitHub](https://github.com/EclesioMeloJunior?ref=blog.chainsafe.io)), respectively.

## Get Involved

If you are interested in getting involved and contributing to the project, check out [our GitHub repository](https://github.com/ChainSafe/gossamer?ref=blog.chainsafe.io). If you would like to get in contact with one of the Gossamer team members, feel free to drop by on [ChainSafe's Discord](https://discord.com/invite/xSAwrnCWcg?ref=blog.chainsafe.io) or email [info@chainsafe.io](mailto:info@chainsafe.io). We would love to know more about you, your team and your project!

For more details on Gossamer, please head to our [documentation site](https://chainsafe.github.io/gossamer/?ref=blog.chainsafe.io).

Learn more about ChainSafe by visiting our [website](https://chainsafe.io/?ref=blog.chainsafe.io), through our [Medium](https://medium.com/chainsafe-systems?ref=blog.chainsafe.io), via [Twitter](https://twitter.com/chainsafeth?ref=blog.chainsafe.io), or visiting the [ChainSafe GitHub](https://github.com/ChainSafe/?ref=blog.chainsafe.io).

![](https://miro.medium.com/0*JtNtRZnM1pn3NS4a)