Skip to main content

aleo-contract-abi-generator

Generates a JSON ABI from deployed Aleo bytecode, and checks one ABI against another for compatibility. Rust bindings around Leo's ABI generation with full snarkVM validation — a program that does not validate does not get an ABI. Everything runs locally; nothing touches the network.

The distribution is aleo-contract-abi-generator; the import module is aleo_abi.

import aleo_abi

abi_json = aleo_abi.generate_abi("simple.aleo", bytecode, "testnet", None)
violations = aleo_abi.check_compatibility(candidate_json, standard_json)

Install

pip install aleo-contract-abi-generator

Most callers want the friendlier hook in the main SDK instead — aleo.abi.generate_abi accepts a Program object or a raw bytecode string, infers the program name, and returns a dict:

from aleo import abi
from aleo.mainnet import Program

result = abi.generate_abi(Program.credits())
result["program"]        # "credits.aleo"

The hook imports this package lazily and raises ImportError with the install command if it is absent — the main SDK does not depend on it.

Generating an ABI

generate_abi(program_name, bytecode, network, imports) returns a pretty-printed JSON string describing the program: its structs, records, mappings, and functions, each field carrying a structured type ({"Primitive": {"Int": "I32"}}, record ownership, visibility).

snarkVM validation is contextual: a program that declares imports is rejected unless those imports are supplied. Pass them as (program_id, bytecode) pairs in topological order — dependencies before dependents:

abi_json = aleo_abi.generate_abi(
    "shield_swap.aleo", amm_bytecode, "testnet",
    [("shield_swap_multisig_core.aleo", multisig_bytecode),
     ("shield_swap_freezelist.aleo", freezelist_bytecode)],
)

network is "mainnet", "testnet", or "canary" — it selects the validation rules, not a connection.

The validation rules are those of the snarkVM release Leo pins, which can trail the main SDK's by one release. Right now this package validates with snarkVM 4.11.0 while aleo-sdk uses 4.12.0: a program with more than 31 mappings, which consensus V22 allows (live on testnet, mainnet from block 22,962,000), parses in the main SDK but is rejected here with "Program exceeds the maximum number of mappings" until Leo moves to 4.12.

Checking compatibility

check_compatibility(candidate_abi_json, standard_abi_json) returns a list of violation strings — empty means the candidate satisfies the standard. Use it to pin a deployed contract's surface and fail your CI when the deployment drifts, instead of your consumers:

violations = aleo_abi.check_compatibility(deployed_abi, pinned_abi)
assert not violations, "\n".join(violations)

This is how shield-swap-sdk's live drift test guards its committed bindings (codegen/regen-abi.sh regenerates the pin from the deployed program).

Downstream: generated Python bindings

The ABI JSON is the input format for the main SDK's aleo.codegen, which emits typed dataclasses and entrypoint stubs from it:

python -m aleo.codegen --abi shield_swap.abi.json --out _generated.py

Tests

cd sdk-abi && python -m pytest python/tests -v   # hermetic — no network

Fixtures and expected ABIs are vendored from Leo's own test suite, so the output shape is pinned to upstream.

Metadata

Release files for aleo-contract-abi-generator 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aleo-contract-abi-generator 0.8.0
File Size Uploaded Provenance Actions
aleo_contract_abi_generator-0.8.0.tar.gz 32.4 kB With provenance Details for aleo_contract_abi_generator-0.8.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for aleo-contract-abi-generator 0.8.0
File Actions
aleo_contract_abi_generator-0.8.0-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details for aleo_contract_abi_generator-0.8.0-cp37-abi3-win_amd64.whl
aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_x86_64.whl CPython 3.7 abi3 Linux glibc 2.28+ x86-64 Details for aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_x86_64.whl
aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_aarch64.whl CPython 3.7 abi3 Linux glibc 2.28+ ARM64 Details for aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_aarch64.whl
aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_11_0_arm64.whl CPython 3.7 abi3 macOS 11.0+ ARM64 Details for aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_11_0_arm64.whl
aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_10_12_x86_64.whl CPython 3.7 abi3 macOS 10.12+ x86-64 Details for aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_10_12_x86_64.whl

Total release size: 12.4 MB

Release files / aleo_contract_abi_generator-0.8.0.tar.gz

Download URL aleo_contract_abi_generator-0.8.0.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
63439afb271c3ba49e9af1bc49e058de043970d490bc042b0d140e51af9dd7ef
BLAKE2b-256 checksum
How to use checksums
16477faae032b8e509190f89866bbb29a4c859ebbcbc7648625e651996d110c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aleo_contract_abi_generator-0.8.0-cp37-abi3-win_amd64.whl

Download URL aleo_contract_abi_generator-0.8.0-cp37-abi3-win_amd64.whl
Size 2.2 MB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
68d09700efaec7d16259cb5a422be7399b5b1e5c86fa843d20d2c93df73c2af7
BLAKE2b-256 checksum
How to use checksums
f1d6fb2901b017b7001f178b07ef517493f90c03d7fd69f6e999b5f40d7c2298
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_x86_64.whl

Download URL aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_x86_64.whl
Size 2.6 MB
Tags CPython 3.7 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
17dd800dca9b9326137b2aa606acf97fe3559af4efece3d9c89f3b45d3abe133
BLAKE2b-256 checksum
How to use checksums
2f7ece64bae584e3b11ed09cfa6285fdc05a5dd41b97e3d48316c88e9d847d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_aarch64.whl

Download URL aleo_contract_abi_generator-0.8.0-cp37-abi3-manylinux_2_28_aarch64.whl
Size 2.7 MB
Tags CPython 3.7 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
bd044bb7b316e8d1d45a760e7d7d528bf4c592f5889cbe141051360ae5e1300e
BLAKE2b-256 checksum
How to use checksums
2adafe9748a7588c4611c0dfcd1faad97d4fa50d42df4de90244e2bd35bb841b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_11_0_arm64.whl

Download URL aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_11_0_arm64.whl
Size 2.4 MB
Tags CPython 3.7 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
01e4f5046e513d4003a2888a3cf8cb01662d6bca0d1e8eba1bab9931a6ea55bc
BLAKE2b-256 checksum
How to use checksums
e05f1ff3a03ec09dc18625ba6ff4115f745a076835a48e8964e8e7ec4323e3ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_10_12_x86_64.whl

Download URL aleo_contract_abi_generator-0.8.0-cp37-abi3-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.7 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8d4d62739f0e49cfedc91555873cb9923fb6727fb3ca6e971095c2a82762f213
BLAKE2b-256 checksum
How to use checksums
a73e048715ce3d8a51df8f9d5def64e2516f7abf3560fd8b841daa1f77afe9b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for aleo-contract-abi-generator 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for aleo_contract_abi_generator-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page