Skip to main content

pyrevm-trace

Python bindings for fast EVM simulation and tracing, built on REVM via PyO3.

Simulate transactions locally, capture call trees, and profile gas usage — no node required.

Features

  • Transaction simulation — execute calls against in-memory EVM state
  • Call tracing — full recursive call tree with inputs, outputs, and success flags
  • Gas profiling — opcode-level gas breakdown
  • Async support — AsyncSimulator offloads to a thread so it won't block your event loop
  • Typed API — Pydantic v2 models for all results

Installation

Requires Python 3.10+ and Rust (for building from source).

uv add pyrevm-trace
# or
pip install pyrevm-trace

To build from source:

git clone https://github.com/salva-imm/pyrevm-trace
cd pyrevm-trace
uv run maturin develop --release

Quick Start

from pyrevm_trace import Simulator

sim = Simulator(chain_id=1)

# Set up state
sim.set_balance("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", 10**18)
sim.set_code("0x1234567890123456789012345678901234567890", bytes.fromhex("600160005260206000f3"))

# Simulate a call
result = sim.simulate(
    caller="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    to="0x1234567890123456789012345678901234567890",
    calldata=b"",
    gas_limit=100_000,
)

print(result.success)    # True
print(result.gas_used)   # e.g. 21318
print(result.return_data.hex())  # 0000...0001

API

Simulator

Synchronous wrapper around EVMSimulator.

from pyrevm_trace import Simulator

sim = Simulator(chain_id=1)
sim.set_balance(address: str, balance: int) -> None
sim.set_code(address: str, bytecode: bytes) -> None
sim.set_storage(address: str, slot: int, value: int) -> None

result: SimulationResult = sim.simulate(
    caller: str,
    to: str,
    calldata: bytes = b"",
    value: int = 0,
    gas_limit: int = 30_000_000,
    with_trace: bool = False,
    with_gas_profile: bool = False,
)

AsyncSimulator

Drop-in async version — simulation runs in a thread via asyncio.to_thread.

import asyncio
from pyrevm_trace import AsyncSimulator

async def main():
    sim = AsyncSimulator(chain_id=1)
    sim.set_code("0x1234...", bytecode)
    result = await sim.simulate(caller="0xabcd...", to="0x1234...", gas_limit=100_000)
    print(result.success)

asyncio.run(main())

Call Tracing

result = sim.simulate(..., with_trace=True)

if result.calls:
    print(result.calls.from_)      # caller address
    print(result.calls.to)         # target address
    print(result.calls.success)    # bool
    for sub in result.calls.calls: # nested calls
        ...

Gas Profiling

result = sim.simulate(..., with_gas_profile=True)

for step in result.gas_steps:
    print(f"pc={step.pc} op=0x{step.op:02x} cost={step.gas_cost}")

with_trace takes priority over with_gas_profile if both are set.

Models

class SimulationResult(BaseModel):
    success: bool
    gas_used: int
    return_data: bytes
    logs: list[Log]
    calls: CallFrame | None          # present when with_trace=True
    gas_steps: list[GasStep] | None  # present when with_gas_profile=True

class Log(BaseModel):
    address: str
    topics: list[str]
    data: bytes

class CallFrame(BaseModel):
    from_: str      # "from" in raw dict
    to: str
    calldata: bytes
    value: str      # decimal string (U256)
    gas_limit: int
    success: bool
    output: bytes
    calls: list[CallFrame]

class GasStep(BaseModel):
    pc: int
    op: int
    gas_remaining: int
    gas_cost: int

Development

# Build Rust extension
uv run maturin develop

# Run tests
uv run pytest

# Run Rust unit tests
cargo test

License

MIT

Metadata

Release files for pyrevm-trace 0.1.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 pyrevm-trace 0.1.0
File Size Uploaded Provenance Actions
pyrevm_trace-0.1.0.tar.gz 52.0 kB With provenance Details for pyrevm_trace-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyrevm-trace 0.1.0
File Actions
pyrevm_trace-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pyrevm_trace-0.1.0-cp312-cp312-win_amd64.whl
pyrevm_trace-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for pyrevm_trace-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyrevm_trace-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) Details for pyrevm_trace-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
pyrevm_trace-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pyrevm_trace-0.1.0-cp311-cp311-win_amd64.whl
pyrevm_trace-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details for pyrevm_trace-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyrevm_trace-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details for pyrevm_trace-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
pyrevm_trace-0.1.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for pyrevm_trace-0.1.0-cp310-cp310-win_amd64.whl
pyrevm_trace-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details for pyrevm_trace-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyrevm_trace-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details for pyrevm_trace-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 9.0 MB

Release files / pyrevm_trace-0.1.0.tar.gz

Download URL pyrevm_trace-0.1.0.tar.gz
Size 52.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2e92f464c55812df2deb8cae7b0a3e87490ce6a9f2bd16558085554222a65dae
BLAKE2b-256 checksum
How to use checksums
3f8e84c8d19d3af4c52952def79572139157dcbb2592e2258b671728dbf5edbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp312-cp312-win_amd64.whl

Download URL pyrevm_trace-0.1.0-cp312-cp312-win_amd64.whl
Size 695.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f292b9a2d3c4a074d71e2dfd2053f5e0a67ecd782c6a28f0ed2fca1989c74051
BLAKE2b-256 checksum
How to use checksums
6bd71b1f8e4dc8e8553d5234af52689471b3ebe6542ea1b0877c84b9a52ab8ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyrevm_trace-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 796.8 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
cf8fdd89653296e24d401aa64f4bcbbd54176c54235cb58dfd769ad040dbebe8
BLAKE2b-256 checksum
How to use checksums
a08cde9c6b42b244bf934a69574200c5c9fc7281facb03e6e5351b0adae21ff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL pyrevm_trace-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.5 MB
Tags CPython 3.12 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4da71b3db66babbef005dcc8ca8a52c2f5bb4a46ca706b2d094efa52516bbd22
BLAKE2b-256 checksum
How to use checksums
3b3ce8046600aa7f409a20702ab3f6f2697dddf3cabb77c911da565879ba214d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp311-cp311-win_amd64.whl

Download URL pyrevm_trace-0.1.0-cp311-cp311-win_amd64.whl
Size 694.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
5fe3ebced28d0aa9ee5ab725d1abd7b0d55ea3616908ca3c34e6f289590a6448
BLAKE2b-256 checksum
How to use checksums
880672e5e04fc4ec1f63c0ef14e957bcc9d356370e44346d6f2b1e96d3f75e9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyrevm_trace-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 796.4 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
b87afa3eb6ef63460c1527981181653a41d6fabbd3dd2e8ac26cc3b252ceb9f6
BLAKE2b-256 checksum
How to use checksums
6a3ee57443b5406b3f1b8b39dd95a553f6698550e44d8ea17d2a85b887ccea12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL pyrevm_trace-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.5 MB
Tags CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b4f68beaf1676ba5d46e3a01b643885404fedc26717fda29178871dcea497906
BLAKE2b-256 checksum
How to use checksums
c3de06c1ccc645757fa694694859213fcf4bff3fd908e789bce35b71cb1685b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp310-cp310-win_amd64.whl

Download URL pyrevm_trace-0.1.0-cp310-cp310-win_amd64.whl
Size 694.6 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
e40ad49e75edf240cc70ffcf147a92e7a0b79d1663e9f3af07b0c1a350bdab35
BLAKE2b-256 checksum
How to use checksums
ff5ed02f6b49ba1fec81e21db761dd3da5e8ca65565e8f569f1c429371230296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyrevm_trace-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 796.6 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
eab1acb79a179a9e71f257c7eae94e03c0799eb7baed91ab0d275fe4e8b5dadd
BLAKE2b-256 checksum
How to use checksums
949972813b91e1de8b1bfae2a871514c32cd6e80d7a79ef6662414e1c4cfb130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Release files / pyrevm_trace-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL pyrevm_trace-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.5 MB
Tags CPython 3.10 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
68af4e14c8bb7df253ef721c6a43f382c008af4baeab831c1a52a9500228d06f
BLAKE2b-256 checksum
How to use checksums
efa449bf4c9dffda8fde9f869ec86b2095e1fca9f3ce17f4df2e02f99e9e1db6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 17, 2026.

Transparency log

Security for pyrevm-trace 0.1.0

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.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for pyrevm_trace-0.1.0.tar.gz

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 May 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

10 release files Full provenance

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