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.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aleo_contract_abi_generator-0.5.0.tar.gz | 32.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aleo_contract_abi_generator-0.5.0-cp37-abi3-win_amd64.whl | CPython 3.7 | abi3 | Windows x86-64 | Details |
| aleo_contract_abi_generator-0.5.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.5.0-cp37-abi3-manylinux_2_28_aarch64.whl | CPython 3.7 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| aleo_contract_abi_generator-0.5.0-cp37-abi3-macosx_11_0_arm64.whl | CPython 3.7 | abi3 | macOS 11.0+ ARM64 | Details |
| aleo_contract_abi_generator-0.5.0-cp37-abi3-macosx_10_12_x86_64.whl | CPython 3.7 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 12.1 MB
Release files / aleo_contract_abi_generator-0.5.0.tar.gz
| Download URL | aleo_contract_abi_generator-0.5.0.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48a5883373a068b74ae23c7f2bd6a90afb41ff04384ec86084283885a6608b96
|
|
BLAKE2b-256 checksum How to use checksums |
46a8326f4573d319bfb2ffb944a57da7e496151fc86f1174659c2fc72eee21bc
|
| 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 Sep 11, 2026.
Transparency logRelease files / aleo_contract_abi_generator-0.5.0-cp37-abi3-win_amd64.whl
| Download URL | aleo_contract_abi_generator-0.5.0-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a34bd56af82aa10ee7ee836d5de8579a6fbad5ef6ffc0fb0bac15e1796c7bd32
|
|
BLAKE2b-256 checksum How to use checksums |
dfebe1ee92732035e5d3b99db04c43f773602118e673fa27b37e7202aa49bd19
|
| 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 Sep 11, 2026.
Transparency logRelease files / aleo_contract_abi_generator-0.5.0-cp37-abi3-manylinux_2_28_x86_64.whl
| Download URL | aleo_contract_abi_generator-0.5.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 |
b25b2b1cbdb7d262b82a58d49924d41eb053cc96a0b784c7d03abcca37e249ee
|
|
BLAKE2b-256 checksum How to use checksums |
22763f4bca6474fd73c92dd7f23c7802499a0272b18df25f0a82d80c793bb01d
|
| 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 Sep 11, 2026.
Transparency logRelease files / aleo_contract_abi_generator-0.5.0-cp37-abi3-manylinux_2_28_aarch64.whl
| Download URL | aleo_contract_abi_generator-0.5.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 |
1df0f4d2b0faacbf4cedc6f9bc77bf882c5316cc034da21d3b10242f6002c73f
|
|
BLAKE2b-256 checksum How to use checksums |
b7eb1658b974914e65a9890a572045d8a7323922ca5ed45f980ff8f3a0dc5554
|
| 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 Sep 11, 2026.
Transparency logRelease files / aleo_contract_abi_generator-0.5.0-cp37-abi3-macosx_11_0_arm64.whl
| Download URL | aleo_contract_abi_generator-0.5.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 |
322159b8803a56c552ec02294631355cc6a10d7e4b285dedf5942840c66656c0
|
|
BLAKE2b-256 checksum How to use checksums |
dd6e398bd7133140f88335c100394702f347f73024de72d97bc8a2f85ffad8a0
|
| 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 Sep 11, 2026.
Transparency logRelease files / aleo_contract_abi_generator-0.5.0-cp37-abi3-macosx_10_12_x86_64.whl
| Download URL | aleo_contract_abi_generator-0.5.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 |
c890035134e61b69f37f8be410b0ca4808530c8a4e1cc306aaa68283a2bfbf02
|
|
BLAKE2b-256 checksum How to use checksums |
e9c9afd97cf5d62ccec11e775fb34659fa09910dea970a56bbd0445c6e88c583
|
| 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 Sep 11, 2026.
Transparency log