GithubHelp home page GithubHelp logo

elicbarbieri / pyrevm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paradigmxyz/pyrevm

0.0 0.0 0.0 78 KB

Python wrapper around https://github.com/bluealloy/revm/ using PyO3

Python 39.23% Rust 59.76% Makefile 1.01%

pyrevm's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.