Skip to content
forked from near/near-evm

EVM interpreter as a NEAR smart contract

License

Notifications You must be signed in to change notification settings

irony-rust/near-evm

 
 

Repository files navigation

NEAR EVM

EVM interpreter as a NEAR smart contract.

It uses the EVM interpreter from SputnikVM.

Prerequisites

To develop Rust contracts you would need to:

  1. Install Rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Add a WebAssembly target to your Rust toolchain:
rustup target add wasm32-unknown-unknown --toolchain stable

Building

$ ./build.sh

This will build the contract code in res/near_evm.wasm.

Usage

Deploy contract on TestNet:

  • Make sure you have the newest version of the NEAR CLI installed by running:
npm install -g near-cli
  • If you are using TestNet, call near login (if you are using local node use NODE_ENV=development before commands below).

  • Create contract's account, e.g. we will use evm:

near create_account evm --masterAccount=<account you used in near login/test.near for local>
  • Deploy the compiled contract from res/near_evm.wasm at the building step:
near deploy --accountId=evm --wasmFile=res/near_evm.wasm
  • TODO: hackery to actually deploy your EVM contract

Testing

  1. Build the evm contract

    1. Ensure truffle is installed
    npm i -g truffle
    1. Build the test contracts
    cd src/tests && ./build.sh
    1. Build the Near EVM contract binary
    cd ../.. && ./build.sh`
  2. Run the all tests including integration test

    cargo test --lib`
  3. To run the RPC tests you must run a local NEAR node:

    1. Check out nearcore from Github
    2. Compile and run nearcore
    cd nearcore && python scripts/start_unittest.py --local --release
    1. Run the tests from this directory in another terminal window:
    cargo test

Troubleshooting

You may need to install nightly if you get an error similar to the following:

error[E0554]: `#![feature]` may not be used on the stable release channel
  1. Install nightly
rustup toolchain install nightly`
  1. Run the Testing commands again

About

EVM interpreter as a NEAR smart contract

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 81.0%
  • Solidity 18.1%
  • Other 0.9%