Skip to content

paritytech/revive-ethereum-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚧⚠️ [WIP] pallet-revive Eth RPC Server

The goal of this project is to provide an Ethereum JSON-RPC API server for the upcoming RISC-V contracts runtime pallet. (forked off from pallet-contracts).

This serves the following purposes:

  • Users can interact with RISC-V contracts using an Ethereum compatible wallet.
  • Developers can use existing Ethereum tooling to interact with pallet-revive.and deploy contracts wherever the new RISC-V runtime pallet is deployed (e.g AssetHub).

Project Structure

  • ./rpc An Ethereum JSON-RPC server, based on jsonrpsee. The API is generated from the official Ethereum JSON-RPC specification. It uses subxt to interact with the Substrate node hosting the RISC-V contracts runtime pallet.

  • ./chain A Node bootstrapped from the minimal template The node is configured with pallet-contracts and an evm adapter pallet.

  • ./demo A barebone html page to interact with the node using MetaMask and Ether.js.

Getting started

Start the node

This command starts the node in --dev mode.

make node

Start the RPC server

This command starts the Ethereum JSON-RPC server, by default it runs on localhost:9090

make rpc

Once both the node and the rpc server are started, you can send transaction to the node through the Ethereum JSON-RPC API. You can use your browser and a wallet such as MetaMask as explained in the following section, or run the examples scripts under ./rpc/examples (see the Makefile for more info on how to run them).

Run the demo

make demo

This will serve a barebone HTML page at http://localhost:3000, that let you interact with the node through MetaMask using Ether.js.

Configure MetaMask

You can use the following instructions to setup MetaMask with the local chain.

Note: When you interact with MetaMask and restart the chain, you need to clear the activity tab (Settings > Advanced > Clear activity tab data) See here for more info on how to reset the account activity.

Add a new network

To interact with the local chain, you need to add a new network in MetaMask. See here for more info on how to add a custom network.

Make sure the node and the rpc server are started, and use the following settings to configure the network (MetaMask > Networks > Add a network manually):

Import Dev account

You will need to import the following account that is endowed with some balance at genesis to interact with the chain. See here for more info on how to import an account.

  • Account: 0x75E480dB528101a381Ce68544611C169Ad7EB342
  • Private Key: a872f6cbd25a0e04a08b1e21098017a9e6194d101d75e13111f71410c59cd57f

Justification and Background

  • Refereunda 885 - Should we allow EVM compatible contracts on Asset Hub?
  • Forum post - Hybrid system chains make Polkadot perimisionless
  • Forum post - Contracts update: Solidity on PolkaVM

Technical references

  • Acala and bodhi.js, Acala's Ethereum RPC server.
  • Ethink, an Ethereum & Polkadot RPC compatibility POC.

About

Ethereum JSON-RPC for RISC-V Smart Contracts

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published