skillfed

canoser

A python implementation of the LCS(Libra Canonical Serialization) for the Libra network.

canoser v0.8.2 76.3K downloads/30d#14,635 on PyPI13
Permissive license Abandoned released

What it is and what it does

Canoser is a Python library that implements canonical serialization (LCS) for the Libra blockchain network. It allows you to define data structures by inheriting from base classes like Struct, RustEnum, and RustOptional, then automatically serialize and deserialize them in a deterministic byte format. This is essential in blockchain consensus where independent validators need to compute identical hashes of the same logical data, even when running different implementations.

The library supports complex nested structures including arrays, maps, tuples, enums with variants, and optional types—all mirroring Rust/Libra semantics. Once you define a structure's fields, serialization and deserialization happen automatically without manual encoding logic. However, the package has been abandoned since 2020-04-02 and its repository is archived, meaning it receives no updates, security patches, or compatibility fixes for newer Python releases.

Use it for:

  • Building Libra network clients or validators that need to serialize transaction arguments and account state in the canonical format.
  • Comparing data structures across independent Libra implementations by hashing their canonical serializations.
  • Defining and exchanging complex nested data types (enums, optional fields, arrays) that must serialize identically across different languages.
  • Testing or prototyping Libra consensus logic in Python where canonical byte representation must match reference implementations.

Worth the install?

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

Canoser implements canonical serialization for Libra network data structures, enabling byte-consistent encoding and decoding of Python objects that can be safely compared across independent implementations.

No, unless you are maintaining legacy Libra integration code written before 2020. The package is abandoned with no active maintenance, no security updates, and no guarantee of compatibility with modern Python versions or current Libra ecosystem evolution. For new projects, seek an actively maintained canonical serialization library.

Install

canoser on PyPI

pip

pip install canoser

uv

uv add canoser

poetry

poetry add canoser

Installing canoser

Before you install

Installation is straightforward with no runtime dependencies. However, the package is abandoned—last release was 2020-04-02 and the repository was archived. No active maintenance means no security updates or compatibility fixes for modern Python versions beyond what was last tested.

License in practice

Licensed under MIT (permissive), so you may use, modify, and distribute the package freely in commercial or private projects with minimal restrictions.

Quickstart

from canoser import Struct, Uint8, Uint64

class MyData(Struct):
    _fields = [
        ('id', Uint64),
        ('bytes_field', [Uint8])
    ]

obj = MyData(id=1, bytes_field=[1, 2, 3])
serialized = obj.serialize()
deserialized = MyData.deserialize(serialized)

Requires Python 3.6 or above; package is no longer maintained, so compatibility with Python versions released after 2020 is not guaranteed.

Verify before relying

  • Whether the package works reliably with Python versions beyond those tested before 2020.
  • Whether serialized output remains compatible with current Libra network validators or if the spec has evolved since 2020.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,325 days since the last release
Last repo commit (repository archived)
First released
Downloads 76,320/month — #14,635 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: canoser-0.8.2-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

libra canonical serializationdeterministic data structure encodingcross-validator data comparisonrust enum serialization pythonblockchain consensus serializationlcs libra serializationcanonical serialize deserialize
blockchainserializationlibra

More Cryptography packages