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.

Release files for aleo-contract-abi-generator 0.3.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.3.0
File Size Uploaded
aleo_contract_abi_generator-0.3.0.tar.gz 29.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for aleo-contract-abi-generator 0.3.0
File
aleo_contract_abi_generator-0.3.0-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details
aleo_contract_abi_generator-0.3.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.3.0-cp37-abi3-manylinux_2_28_aarch64.whl CPython 3.7 abi3 Linux glibc 2.28+ ARM64 Details
aleo_contract_abi_generator-0.3.0-cp37-abi3-macosx_11_0_arm64.whl CPython 3.7 abi3 macOS 11.0+ ARM64 Details
aleo_contract_abi_generator-0.3.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.3.0.tar.gz

Download URL aleo_contract_abi_generator-0.3.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
852583a00706d09b4fd3c0353741c0142443d7d180a83be1af9fcab4b905a2d5
BLAKE2b-256 checksum
How to use checksums
cd9f45ef989b7463aa37a662adcb737d27d73b4f300601f8da4050fa8edaca5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.3.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
ed3a65ed659c28bd7dbf52d0a00ca377468ee561e350cd354f6eb3e016ccb7a7
BLAKE2b-256 checksum
How to use checksums
8bc3349c951bce7a332f1fff41563ac261cec0381da471db4d237dcea598e4b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.3.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
304c95fbab4a2a443c8b5887aeec1e33372ed58e27306a7a91c7c261c336b0d2
BLAKE2b-256 checksum
How to use checksums
21ce9883361a220ab478ef2019330053a96c6a168816606c100642a1a2e77698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.3.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
92df153cb5bcaba0ffe7bb8ceec9144ebecd90711e0614e661ca2f21ea0c2708
BLAKE2b-256 checksum
How to use checksums
f7b7a3dc3459017a58c22b711f215b891eee357cb4636c6f9caff398aa01d2e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.3.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
1449889002b37c512de32091af59d336c5cc77097d13fea5c90aa44ad474b2b4
BLAKE2b-256 checksum
How to use checksums
5724554d60df9c07e4b451bdcef15537ab9af8a37b2bc94dcf663bfe547e7630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

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

Download URL aleo_contract_abi_generator-0.3.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
f6f50df8980165aa82bd54e4f2680e4c9509ef4f8ab3e698d42bf8c510d13154
BLAKE2b-256 checksum
How to use checksums
1623616cf9c5b1e901bf4d1f19a2d4206798a6642f1e9a2acfa272d84b33a4ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

6 release files

0.5.0

6 release files

0.4.0

6 release files

This release

0.3.0 This release

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