skillfed

scalecodec

Python SCALE Codec Library

scalecodec v1.2.12 345.4K downloads/30d#7,363 on PyPI59
Permissive license AGING released

What it is and what it does

Scalecodec is a Python implementation of the SCALE codec, the serialization format used by Substrate and Polkadot-based blockchains. It provides encoding and decoding for a range of data types—from basic integers and booleans to complex aggregates like vectors and bit sequences—using little-endian fixed-width and compact integer formats to minimize network overhead.

The package is typically used by developers building tools, wallets, or indexers that interact with Substrate chains, where they need to serialize Python objects into SCALE format for on-chain calls or deserialize chain data back into Python types. It depends on more-itertools, base58, and requests, and targets Python 3.6 and later.

Use it for:

  • Serialize transaction data for submission to Polkadot or Kusama networks.
  • Deserialize blockchain state and event data returned from Substrate RPC endpoints.
  • Build indexers or data pipelines that read and transform on-chain events.
  • Encode function arguments for extrinsic calls in Substrate-based applications.
  • Integrate blockchain data into Python-based analytics or monitoring tools.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Encodes and decodes data using the SCALE codec, a lightweight serialization format used by Substrate-based blockchains to optimize network communication.

Yes, if you are building on Substrate or Polkadot. The package is stable, permissively licensed, and has low install friction. Maintenance is aging but the repository is not archived and the package remains in active use. No known vulnerabilities. Not relevant for non-blockchain Python projects.

Install

scalecodec on PyPI

pip

pip install scalecodec

uv

uv add scalecodec

poetry

poetry add scalecodec

Installing scalecodec

Before you install

Low install friction with a pure Python wheel. Maintenance is aging—last commit was 302 days ago—but the repository remains active and the package is marked Production/Stable.

License in practice

Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

pip install scalecodec

from scalecodec.base import RuntimeConfiguration
from scalecodec.types import U16

config = RuntimeConfiguration()
value = U16(42)
encoded = value.encode()
print(encoded.hex())

Requires Python 3.6 or later; designed for Substrate/Polkadot ecosystem integration.

Verify before relying

  • Whether the package handles all Substrate runtime types beyond the basic examples shown in the description.
  • Performance characteristics when encoding/decoding large or deeply nested data structures.
  • Compatibility with the latest Substrate runtime versions and breaking changes.

Package facts

License not declared (permissive)
Python support supports the current Python release (<4,>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — more-itertools, base58, requests
Maintenance aging — 302 days since the last release
Last repo commit
First released
Downloads 345,396/month — #7,363 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: scalecodec-1.2.12-py3-none-any.whl

Keywords: scale, codec, polkascan, polkadot, substrate, blockchain, kusama

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

scale codec encoding decodingsubstrate serializationpolkadot data serializationblockchain scale codeccompact integer encodingsubstrate network protocolscale codec python
blockchainsubstrate-polkadotserialization

More Internet packages