Skip to main content

Work with a Local Node

This tutorial describes how to set up a local node and use it with REMIX.

Prerequisites

Before you begin, ensure you have the following:

  • MetaMask: Install the MetaMask browser extension. This will allow you to interact with your local blockchain.

Install Dependencies

Follow the instructions on Installing Dependencies from the Polkadot wiki up to the "Verifying Installation" section.

Clone the Polkadot SDK Repository

Open your terminal and run the following commands to clone the Polkadot SDK repository:

git clone https://github.com/paritytech/polkadot-sdk

Build and Run the Kitchensink Node

To build and run the Kitchensink node, use the following command inside the just-cloned repo:

RUST_LOG="error,evm=debug,sc_rpc_server=info,runtime::revive=debug" cargo run --release --bin substrate-node -- --dev

Build and Run Eth RPC Proxy

This RPC proxy translates Ethereum-compatible requests into Substrate-compatible requests.

It acts as a bridge between Ethereum tools, like MetaMask and Remix, and the Substrate-based network, enabling Ethereum applications to interact seamlessly with Substrate-based chains by interpreting Ethereum RPC calls and routing them to the appropriate Substrate functions. This way, developers can work with familiar Ethereum-based tools.

Open another terminal window and run the Eth RPC proxy from the same directory:

RUST_LOG="info,eth-rpc=debug" cargo run --release -p pallet-revive-eth-rpc -- --dev

Metamask Configuration

  1. Import the following private key into MetaMask to access your pre-funded local account: 5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133

  2. Connect your MetaMask wallet to a local server using the following link:

Or add it manually
  • Network name: Kitchensink local
  • RPC URL URL: http://localhost:8545
  • Chain ID: 420420420
  • Currency Symbol: DEV
  1. Make sure that the Kitchensink Local Testnet network is selected

REMIX Setup

  1. Open the REMIX IDE.
  2. Navigate to the Deploy & Run tab. In the Environment dropdown, select Customize this list....
  3. Enable INJECTED PROVIDER - METAMASK in the Deploy using a Browser Extension section.
  4. From the Environment dropdown, select the enabled Injected Provider - MetaMask.
  5. Select the pre-founded local account

To compile and deploy your smart contract, refer to the Deploying Your First Contract tutorial, keeping the environment settings configured in this section.

Note: When you restart the Kitchensink node, you will need to reset the nonce in MetaMask. To do this, go to Settings -> Advanced in MetaMask and select Clear activity tab data.