Python bindings for ABI generation from Aleo bytecode
Project description
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_v3.aleo", amm_bytecode, "testnet",
[("test_shield_swap_multisig_core.aleo", multisig_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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aleo_contract_abi_generator-0.2.2.tar.gz.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ea8a8c278650b086d94a6d8ce6329fe2d85587ce6a8f4255b1c6ffcbc6a7fc
|
|
| MD5 |
2d5f375d255e8bc69bd67517e743b53e
|
|
| BLAKE2b-256 |
d46f98eb469312bf9854cdcd4ddd5bb301884fd7d4d3d2b46393846c9a7b39ca
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2.tar.gz:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2.tar.gz -
Subject digest:
27ea8a8c278650b086d94a6d8ce6329fe2d85587ce6a8f4255b1c6ffcbc6a7fc - Sigstore transparency entry: 2187057831
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file aleo_contract_abi_generator-0.2.2-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd7953960f45f51974a3842b5d7a348e187bd79b3a3b4cb9820b12a24ba92262
|
|
| MD5 |
2141794592ec789091debf0f551483b6
|
|
| BLAKE2b-256 |
ffd4ff2bec5304c5e892c9bf0a41e7a2b32e0ff73daded830d6654319b677c25
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2-cp37-abi3-win_amd64.whl:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2-cp37-abi3-win_amd64.whl -
Subject digest:
cd7953960f45f51974a3842b5d7a348e187bd79b3a3b4cb9820b12a24ba92262 - Sigstore transparency entry: 2187057886
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b32efde32a8f5ef7bb1773414c35e254e9cf752da1e399e1007336f5cd94b10
|
|
| MD5 |
cfe7afcdf1d52d756f01c269c36d9541
|
|
| BLAKE2b-256 |
a7b7c748a3e87a23894cd93d8b69f63b02242eb9c12df439b09cfe926cea862a
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_x86_64.whl:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
3b32efde32a8f5ef7bb1773414c35e254e9cf752da1e399e1007336f5cd94b10 - Sigstore transparency entry: 2187057854
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2658951ffaf8e4fc2e99e7cab0ea38ac22836af57ce1e26eabd702c3951214a7
|
|
| MD5 |
46a6a5b1c7632bfcaef5200a5ec63797
|
|
| BLAKE2b-256 |
4b9abaadf6c4efe986cbbeaf89ba62704744e838981443b081662daf679167c9
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_aarch64.whl:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2-cp37-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
2658951ffaf8e4fc2e99e7cab0ea38ac22836af57ce1e26eabd702c3951214a7 - Sigstore transparency entry: 2187057841
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8565f4cd1647b9b724c8cf199ddbec080797b70bfcdaaf5b8cffa10fe5bf682
|
|
| MD5 |
c833d2602f759ae6d30a5c605f444cae
|
|
| BLAKE2b-256 |
23455659bf6ecfb30d94a613f172559410f7aab79152442b624dda80dbc53e24
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_11_0_arm64.whl:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
d8565f4cd1647b9b724c8cf199ddbec080797b70bfcdaaf5b8cffa10fe5bf682 - Sigstore transparency entry: 2187057867
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd41d82a00753fa012830b3d8b1d092eddffbe1aca89090c7b9907269c8ff275
|
|
| MD5 |
8a294bd96ab88b3f3d3168a32f8e252e
|
|
| BLAKE2b-256 |
5ddc3459dae16e82fe3adab8ec495318b74e48130e01ef757e8a97878d8faa4a
|
Provenance
The following attestation bundles were made for aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_10_12_x86_64.whl:
Publisher:
sdk-wheels.yml on ProvableHQ/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aleo_contract_abi_generator-0.2.2-cp37-abi3-macosx_10_12_x86_64.whl -
Subject digest:
dd41d82a00753fa012830b3d8b1d092eddffbe1aca89090c7b9907269c8ff275 - Sigstore transparency entry: 2187057904
- Sigstore integration time:
-
Permalink:
ProvableHQ/python-sdk@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ProvableHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-wheels.yml@9cb3d2a160da5a145da61adf50441eb577df1d6f -
Trigger Event:
push
-
Statement type: