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.

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.4.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.4.0
File Size Uploaded
aleo_contract_abi_generator-0.4.0.tar.gz 29.4 kB Details

Built distributions (wheels)

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

Total release size: 11.9 MB

Release files / aleo_contract_abi_generator-0.4.0.tar.gz

Download URL aleo_contract_abi_generator-0.4.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b2275f8fe69fae4183e4fe1d691cd1ca75bffa828329c2a57d6690deb010b387
BLAKE2b-256 checksum
How to use checksums
fd1bf7005cf47a5f744aa38d2a4eadf04ac4b61cb2b95dc41bdef3ff4b7a47ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.4.0-cp37-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e48cb9ef58c2d57f9915ee7e53274a89731b8bc295a49823a7de85fc6eb15cff
BLAKE2b-256 checksum
How to use checksums
0b288a0f2b5b2c2b5cabe0444d831cdae74e269b25f94f966dc954cd7111266b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.4.0-cp37-abi3-manylinux_2_28_x86_64.whl
Size 2.5 MB
Tags CPython 3.7 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d6ce745582b7ef5c5c239078c45fcf92b2b1f117d40cab8717c199c9b2e9fa31
BLAKE2b-256 checksum
How to use checksums
0a404730bc05eb520bcb36d3fabf8b7937d22c9ec6cb3a175a85dc7a253e5256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.4.0-cp37-abi3-manylinux_2_28_aarch64.whl
Size 2.6 MB
Tags CPython 3.7 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
8b92bad7217bec26a286e0bf0e8eb143716fe149f31bba4994737fd7fc836a3d
BLAKE2b-256 checksum
How to use checksums
cca8020243b653e3bc4516b514866ac711f9bf251f09b3c6830bd73667d79e3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.4.0-cp37-abi3-macosx_11_0_arm64.whl
Size 2.3 MB
Tags CPython 3.7 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
97f48bea43a3e8caf09d3e5d3f72664e24f17c9074b33d87d37226aad5b3639d
BLAKE2b-256 checksum
How to use checksums
4be416cf75cb7a4aa66dd2aab6c118157e2157980815e6554c9a081bdbbe7a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.4.0-cp37-abi3-macosx_10_12_x86_64.whl
Size 2.4 MB
Tags CPython 3.7 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ad4d707054dc817db5d575125eac8531ee50fe1a1a7e1fb7683268e1e426b0e2
BLAKE2b-256 checksum
How to use checksums
be4076437fb41affb5a0434e3f2cb36fa88816af1604142eabdf49093a9adc24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

6 release files

0.5.0

6 release files

This release

0.4.0 This release

6 release files

0.3.0

6 release files

0.2.2

6 release files

0.2.1

6 release files

0.2.0

6 release files

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