The major part of this work was done by James Prestwich and Barbara Liau from https://summa.one/.
TLDR: Today we are releasing a set of tools to deploy EVM contracts on the NEAR network, thus benefiting from the performance, user experience and developer tooling of NEAR. Underneath, it’s implemented as an execution environment which runs Ethereum as a smart contract on NEAR. Web3.js tooling works with NEAR via a custom provider.EVM support and web3.js provider
Ethereum’s developer community is large, and many crypto developers are familiar with the Ethereum Virtual Machine (EVM). Solidity, an EVM-targeted language, has been developed since the beginning to serve as the primary language for smart contracts. While it has clear limitations when compared to general purpose languages like Rust and TypeScript, Solidity maintains broad adoption and extensive tooling for on-chain development. NEAR, on the other hand, uses the WebAssembly Virtual Machine (WASM), an increasingly popular technology both in crypto and in the wider tech world. The majority of the crypto space is moving in this direction, with projects like ETH2, Polkadot, and more deciding to use WASM. While we believe strongly in WebAssembly, we recognize the need to simplify this transition for developers, and are releasing a way for existing EVM contracts to run on NEAR. To do so, we’ve deployed the EVM as a smart contract. Conveniently, the Parity Ethereum client has an EVM implementation in Rust that is easily compilable to WebAssembly. Running the EVM as a smart contract is essentially a simplified version of the ETH2 / Serenity execution environment concept, and it doesn't require any custom transaction processing logic! You can find the EVM contract on Github. Since the majority of Ethereum tooling relies on web3.js, we’ve implemented a custom web3 provider, NearProvider, that allows direct communication to Ethereum contracts via familiar interfaces in near-web3-provider library. NearProvider handles the connection to the Near network, and automatically translates objects and RPC calls for you. Let’s dig in!How it works
First, let’s get your Solidity application running on NEAR’s TestNet: If you don’t have an existing Truffle project, set it up first. You can find the example here - https://github.com/kcole16/near-evm-demo. Next, install NEAR shell: npm install -g near-shell Then, login with NEAR wallet: near login This will redirect you to the NEAR web wallet, and walk you through creating a new account. You can enter any accountID you’d like to use going forward. Next, you will authorize the CLI to use this account via a transaction, and then enter the newly created accountID to complete the login. The next step is to configure NEAR as another network in truffle.js:Resources
Here are the useful resources:- https://github.com/kcole16/near-evm-demo - repo with full demo.
- https://github.com/nearprotocol/near-evm - EVM execution environment contract.
- https://github.com/nearprotocol/near-web3-provider - NearProvider for Web3.js.
- https://t.me/joinchat/F3YJ0lcCcZka_GN09MGwJw - Developer support channel on Telegram for real time questions.
- https://commonwealth.im/near - forum for ideas and suggestions.