Skip to main content

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 functions
  • events: List of events
  • errors: List of custom errors
  • constructor: Optional constructor function
  • fallback: Optional fallback function
  • receive: Optional receive function

Each function contains:

  • name: Function name
  • inputs: List of input parameters
  • outputs: List of output parameters
  • state_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

Metadata

Release files for heimdall-py 0.9.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for heimdall-py 0.9.11
File Size Uploaded
heimdall_py-0.9.11.tar.gz 663.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for heimdall-py 0.9.11
File Interpreter ABI Platform
heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 12.3 MB

Release files / heimdall_py-0.9.11.tar.gz

Download URL heimdall_py-0.9.11.tar.gz
Size 663.3 kB
Tags Source
SHA-256 checksum
How to use checksums
48758f7fe35b49095d6fa82a9e70047149b1f780cbb171fd7a5930ebbe3ccb6c
BLAKE2b-256 checksum
How to use checksums
2555fafeeb22de0748fb71975548243deacdd1891d92c5b3cc5b384bbc1fe5df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 27, 2025.

Transparency log

Release files / heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8fe7859c6be75aefbb39abe9d6d46031c5d23eed6007ecb0be27f139a899581c
BLAKE2b-256 checksum
How to use checksums
32b65283bf9692cda9131b8eb9cd4465542ec987a3c700c806b91cfe38646792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 27, 2025.

Transparency log

Release files / heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl

Download URL heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl
Size 3.7 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ef927c87b309d5a06e4a2b68add8bc89abfdf0547e4b8884575e07fd0066f1ba
BLAKE2b-256 checksum
How to use checksums
ddfd12b1d085afd94b0f202f1ea2f155ce03fa454dd72786578d4fb50e89dc7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 27, 2025.

Transparency log

Release files / heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl

Download URL heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl
Size 3.9 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
cb50ee83035747138c9b850533ae5fa689fc3efa9a45b12086495bd5cfc5e225
BLAKE2b-256 checksum
How to use checksums
1ab4817dce05d845890a5a5c388b022b7c57bc66a3aaeb72a619dd1a9f027532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 27, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.11 This release

4 release files

0.9.10

4 release files

0.9.9

4 release files

0.9.8

4 release files

0.9.7

4 release files

0.9.6

4 release files

0.9.4

4 release files

0.9.3

4 release files

0.9.2

4 release files

0.9.1

3 release files

0.9.0

5 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