scalecodec
Python SCALE Codec Library
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 scalecodecuv
uv add scalecodecpoetry
poetry add scalecodecInstalling 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
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
cobsEncodes and decodes data using Consistent…
permissive · top 15,000 on PyPI
cyscaleCython-accelerated encoder and decoder for the…
permissive · top 15,000 on PyPI
substrate-interfaceInterfaces with Substrate blockchain nodes to…
permissive · top 15,000 on PyPI
async-substrate-interfaceProvides asynchronous and synchronous…
permissive · top 15,000 on PyPI
rlpEncodes and decodes data using Recursive Length…
permissive · top 5,000 on PyPI
bech32mEncodes and decodes Bech32 and Bech32m strings,…
permissive · top 15,000 on PyPI
pyasn1Pyasn1 encodes and decodes ASN.1 data…
permissive · top 100 on PyPI
prophyProphy is a binary serialization protocol with…
permissive · top 15,000 on PyPI
eth-rlpProvides RLP (Recursive Length Prefix) encoding…
permissive · top 5,000 on PyPI
pytoniq-corepytoniq-core provides low-level primitives for…
unclear · top 15,000 on PyPI