:warning: This repository contains obsolete EVM contract experiments.
Find current development at: https://github.com/aurora-is-near/aurora-engine
EVM interpreter as a NEAR smart contract. This uses the EVM interpreter from SputnikVM.
Network | Account |
---|---|
LocalNet | evm.test.near |
BetaNet | evm.$MYACCOUNT.betanet |
TestNet | evm.$MYACCOUNT.testnet |
To develop Rust contracts, change into the top-level directory in this repository, and do the following:
Make sure you have the newest version of the NEAR CLI installed by running:
npm install -g near-cli
Install Rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Add a WebAssembly target to your Rust toolchain:
rustup target add wasm32-unknown-unknown
./build.sh
This will build the contract code in res/near_evm.wasm
.
Deploy the EVM contract:
If you are using BetaNet or TestNet, execute near login
.
If you are using LocalNet, set the NODE_ENV=local
environment variable
prior to executing any of the commands below.
Create the contract account:
# LocalNet
near create-account evm.test.near --masterAccount=test.near
# BetaNet
near create-account evm.myaccount.betanet --masterAccount=myaccount.betanet
# TestNet
near create-account evm.myaccount.testnet --masterAccount=myaccount.testnet
Deploy the built contract from res/near_evm.wasm
:
# LocalNet
near deploy --accountId=evm.test.near --wasmFile=res/near_evm.wasm
# BetaNet
near deploy --accountId=evm.myaccount.betanet --wasmFile=res/near_evm.wasm
# TestNet
near deploy --accountId=evm.myaccount.testnet --wasmFile=res/near_evm.wasm
Build the EVM contract:
./build.sh
npm i -g truffle
cd tests && ./build.sh
Run the all tests including integration tests:
cargo test --lib
To run the RPC tests you must run a local NEAR node:
nearcore
from GitHub.nearcore
:
cd nearcore && python scripts/start_unittest.py --local --release
cargo test
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
nightly
:
rustup toolchain install nightly