GithubHelp home page GithubHelp logo

evm-run's Introduction

evm-run

Run evm code from console or from file, on local env or mainnet fork.

Setup

Clone this repo and run the following command:

cargo install --path .

Usage

Run code directly

Calculates square

$ evm-run --code 348002600052596000f3 --value 3
34 CALLVALUE
80 DUP1      Stack: 3
2 MUL        Stack: 3,3
60 PUSH1     Stack: 9
52 MSTORE    Stack: 0,9
59 MSIZE                Memory: 0000000000000000000000000000000000000000000000000000000000000009
60 PUSH1     Stack: 20  Memory: 0000000000000000000000000000000000000000000000000000000000000009
f3 RETURN    Stack: 0,20 Memory: 0000000000000000000000000000000000000000000000000000000000000009
Returned: 0000000000000000000000000000000000000000000000000000000000000009
gasUsed : 24

Run pseudo code

$ evm-run --code 'push1 02 push1 03 add stop'
code 600260030100
60 PUSH1
60 PUSH1 Stack: 2
1 ADD    Stack: 3,2
0 STOP   Stack: 5
Returned:
gasUsed : 9

Mainnet fork

Run evm code against mainnet fork, to get balance of vitalik.

% evm-run 363d600C373d51313d52593df3 --calldata d8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --rpc https://eth-mainnet.alchemyapi.io/v2/<API-KEY> --block 14379250
36 CALLDATASIZE
3d RETURNDATASIZE Stack: 14
60 PUSH1          Stack: 0,14
37 CALLDATACOPY   Stack: C,0,14
3d RETURNDATASIZE               Memory: 000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045
51 MLOAD          Stack: 0      Memory: 000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045
31 BALANCE        Stack: D8DA6BF26964AF9D7EED9E03E53415D37AA96045 Memory: 000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045
3d RETURNDATASIZE Stack: E034B8C125409C0113                       Memory: 000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045
52 MSTORE         Stack: 0,E034B8C125409C0113                     Memory: 000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045
59 MSIZE                                                          Memory: 0000000000000000000000000000000000000000000000e034b8c125409c0113
3d RETURNDATASIZE Stack: 20                                       Memory: 0000000000000000000000000000000000000000000000e034b8c125409c0113
f3 RETURN         Stack: 0,20                                     Memory: 0000000000000000000000000000000000000000000000e034b8c125409c0113
Returned: 0000000000000000000000000000000000000000000000e034b8c125409c0113
gasUsed : 2630

Run block

evm-run --block 20132136 --rpc https://eth-mainnet.g.alchemy.com/v2/<API-KEY>
running block
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 1589329/12195104

evm-run's People

Contributors

zemse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

afrideva

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.