Python bindings for Heimdall - Advanced EVM bytecode analysis toolkit
Project description
Heimdall Python Bindings
Python bindings for the Heimdall EVM decompiler, providing access to extract ABI (Application Binary Interface) from EVM bytecode.
Installation
Build and install the Python module:
# From the heimdall-rs root directory
cd crates/python
maturin develop
Usage
import heimdall_py
# Decompile bytecode to extract ABI
bytecode = "0x60806040..."
abi = heimdall_py.decompile_code(bytecode)
# Access functions
for func in abi.functions:
print(f"Function: {func.name}")
print(f" Inputs: {[(p.name, p.type_) for p in func.inputs]}")
print(f" Outputs: {[(p.name, p.type_) for p in func.outputs]}")
print(f" State Mutability: {func.state_mutability}")
print(f" Payable: {func.payable}")
# Access events
for event in abi.events:
print(f"Event: {event.name}")
for param in event.inputs:
print(f" {param.name}: {param.type_} (indexed: {param.indexed})")
# Access errors
for error in abi.errors:
print(f"Error: {error.name}")
for param in error.inputs:
print(f" {param.name}: {param.type_}")
# Special functions
if abi.constructor:
print(f"Constructor inputs: {[(p.name, p.type_) for p in abi.constructor.inputs]}")
if abi.fallback:
print(f"Has fallback function (payable: {abi.fallback.payable})")
if abi.receive:
print("Has receive function")
ABI Structure
The decompiler returns an ABI object with the following structure:
functions: List of regular functionsevents: List of eventserrors: List of custom errorsconstructor: Optional constructor functionfallback: Optional fallback functionreceive: Optional receive function
Each function contains:
name: Function nameinputs: List of input parametersoutputs: List of output parametersstate_mutability: One of "pure", "view", "nonpayable", or "payable"constant: Boolean indicating if function is constant (view/pure)payable: Boolean indicating if function accepts Ether
Development
To build the Python bindings:
# Install maturin
pip install maturin
# Build in development mode
maturin develop
# Build release wheel
maturin build --release
Requirements
- Python 3.10+
- Rust toolchain
- maturin for building
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 heimdall_py-0.9.11.tar.gz.
File metadata
- Download URL: heimdall_py-0.9.11.tar.gz
- Upload date:
- Size: 663.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48758f7fe35b49095d6fa82a9e70047149b1f780cbb171fd7a5930ebbe3ccb6c
|
|
| MD5 |
b8761a14e9e24fcebeba78430534cd67
|
|
| BLAKE2b-256 |
2555fafeeb22de0748fb71975548243deacdd1891d92c5b3cc5b384bbc1fe5df
|
Provenance
The following attestation bundles were made for heimdall_py-0.9.11.tar.gz:
Publisher:
python-release.yml on jalbrekt85/heimdall-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heimdall_py-0.9.11.tar.gz -
Subject digest:
48758f7fe35b49095d6fa82a9e70047149b1f780cbb171fd7a5930ebbe3ccb6c - Sigstore transparency entry: 564871717
- Sigstore integration time:
-
Permalink:
jalbrekt85/heimdall-py@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jalbrekt85
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fe7859c6be75aefbb39abe9d6d46031c5d23eed6007ecb0be27f139a899581c
|
|
| MD5 |
1cfaf5266c7ac013e19174db5a5cf681
|
|
| BLAKE2b-256 |
32b65283bf9692cda9131b8eb9cd4465542ec987a3c700c806b91cfe38646792
|
Provenance
The following attestation bundles were made for heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-release.yml on jalbrekt85/heimdall-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
8fe7859c6be75aefbb39abe9d6d46031c5d23eed6007ecb0be27f139a899581c - Sigstore transparency entry: 564871732
- Sigstore integration time:
-
Permalink:
jalbrekt85/heimdall-py@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jalbrekt85
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef927c87b309d5a06e4a2b68add8bc89abfdf0547e4b8884575e07fd0066f1ba
|
|
| MD5 |
353df75c705cd7c300b2a8418817ee57
|
|
| BLAKE2b-256 |
ddfd12b1d085afd94b0f202f1ea2f155ce03fa454dd72786578d4fb50e89dc7f
|
Provenance
The following attestation bundles were made for heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on jalbrekt85/heimdall-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
ef927c87b309d5a06e4a2b68add8bc89abfdf0547e4b8884575e07fd0066f1ba - Sigstore transparency entry: 564871724
- Sigstore integration time:
-
Permalink:
jalbrekt85/heimdall-py@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jalbrekt85
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb50ee83035747138c9b850533ae5fa689fc3efa9a45b12086495bd5cfc5e225
|
|
| MD5 |
8c523ba1702aa3bb965cdc8469fa5105
|
|
| BLAKE2b-256 |
1ab4817dce05d845890a5a5c388b022b7c57bc66a3aaeb72a619dd1a9f027532
|
Provenance
The following attestation bundles were made for heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
python-release.yml on jalbrekt85/heimdall-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
cb50ee83035747138c9b850533ae5fa689fc3efa9a45b12086495bd5cfc5e225 - Sigstore transparency entry: 564871720
- Sigstore integration time:
-
Permalink:
jalbrekt85/heimdall-py@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jalbrekt85
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@f73da59ba9385a6d2ec4ce8e51da1527e7e9ea03 -
Trigger Event:
workflow_dispatch
-
Statement type: