Skip to main content

No project description provided

Project description

pyrevm

Blazing-fast Python bindings to revm

py rust

Quickstart

make install
make test

Example Usage

Here we show how you can fork from Ethereum mainnet and simulate a transaction from vitalik.eth.

from pyrevm import *

address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" # vitalik.eth
address2 = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"

fork_url = "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"

# set up an evm
evm = EVM(
    # can fork from a remote node
    fork_url=fork_url, 
    # can set tracing to true/false
    tracing = True, 
    # can configure the environment
    env = Env(
        block = BlockEnv( timestamp = 100
    ))
);

vb_before = evm.basic(address)
assert vb_before != 0

# Execute the tx
evm.call_raw_committing(
    caller = address,
    to = address2,
    value = 10000
    # data
);

assert vb_before != evm.basic(address)
assert evm.basic(address2).balance == 10000

Develop

We use Poetry for virtual environment management and Maturin as our Rust <> Python FFI build system. The Rust bindings are auto-generated from the macros provided by PyO3.

To build the library, run poetry run maturin develop

Note: If building for production, do not forget the --release flag, else performance will be degraded.

Benchmarks

TODO

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

pyrevm-0.1.0.tar.gz (44.6 kB view details)

Uploaded Source

File details

Details for the file pyrevm-0.1.0.tar.gz.

File metadata

  • Download URL: pyrevm-0.1.0.tar.gz
  • Upload date:
  • Size: 44.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for pyrevm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 27dfd3683506336f072d43039d64cd2d0e4035a0ceb810bdfaa58db607c2528b
MD5 54bc98ebb6182264f14459a55922e676
BLAKE2b-256 97050404680fe656b705720efe947a4962e5fd4b4acf22ccc4848a5c01d46fe6

See more details on using hashes here.

Supported by

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