Git Product home page Git Product logo

evmjs's People

Contributors

clementdbs avatar mortimr avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

evmjs's Issues

[V0.1] Core Class

The core class should take several arguments when built:

  • smart contract bytecode
  • address of caller
  • data payload of caller

For V0.1, we will only take these arguments. When implementing the opcodes, you will see that you will need other variables (like block number, balances etc) Ignore them for the moment and set default values on them.

No gas for the moment, when you run a method, it either succeed, fail, or run infinitely.
Gas will be added in V1.

[V0.1] Command Line Arguments

The final script should be able to take command line arguments and give them to the Core Class. Then it should run a simulation and output any result

This is how the command line script should work:

node script.js smart_contract.sol method_name arg1 arg2 ... argn

You should ouput as much informations as possible:

  • State after call
  • Return values if any
  • Storage after call

[V0.1] Smart Contract Method Call Encoder

Create a encoder that takes as argument an ABI definition, a method name and a non-fixed amount of arguments, and returns an encoded output (an hexadecimal string).

This link might help you =>https://solidity.readthedocs.io/en/develop/abi-spec.html

The examples section is explaining very well how to encode.

  • Use the ABI definition of the smart contract to determine the number of arguments and their types
  • Use the method name to create the method signature described in the document above
  • Use the remaining arguments and encode them according to the documentation above
  • Return the result string

[V0.1] OpCodes

Implement all the EVM OpCodes.

All of them should take the exact same arguments:

  • Current PC (Program Counter)
  • Contract Bytecode (the bytecode of the smart contract as he would be after being compiled)
  • Data Bytecode (the bytecode received from the transaction)
  • Memory Data (Memory, Stack and Storage sections)
  • Env (all the data accessible from the code, block number, transaction hash etc)

Also think of a smart way of retrieving internal errors (throws, stack underflows ...) and display them with the most possible informations.

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.