Skip to main content

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 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heimdall_py-0.9.11.tar.gz (663.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

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

Hashes for heimdall_py-0.9.11.tar.gz
Algorithm Hash digest
SHA256 48758f7fe35b49095d6fa82a9e70047149b1f780cbb171fd7a5930ebbe3ccb6c
MD5 b8761a14e9e24fcebeba78430534cd67
BLAKE2b-256 2555fafeeb22de0748fb71975548243deacdd1891d92c5b3cc5b384bbc1fe5df

See more details on using hashes here.

Provenance

The following attestation bundles were made for heimdall_py-0.9.11.tar.gz:

Publisher: python-release.yml on jalbrekt85/heimdall-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for heimdall_py-0.9.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8fe7859c6be75aefbb39abe9d6d46031c5d23eed6007ecb0be27f139a899581c
MD5 1cfaf5266c7ac013e19174db5a5cf681
BLAKE2b-256 32b65283bf9692cda9131b8eb9cd4465542ec987a3c700c806b91cfe38646792

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for heimdall_py-0.9.11-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef927c87b309d5a06e4a2b68add8bc89abfdf0547e4b8884575e07fd0066f1ba
MD5 353df75c705cd7c300b2a8418817ee57
BLAKE2b-256 ddfd12b1d085afd94b0f202f1ea2f155ce03fa454dd72786578d4fb50e89dc7f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for heimdall_py-0.9.11-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cb50ee83035747138c9b850533ae5fa689fc3efa9a45b12086495bd5cfc5e225
MD5 8c523ba1702aa3bb965cdc8469fa5105
BLAKE2b-256 1ab4817dce05d845890a5a5c388b022b7c57bc66a3aaeb72a619dd1a9f027532

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page