Interacting with a Moonbeam Node Using MetaMask¶
This guide outlines steps for connecting MetaMask to a self-contained Moonbeam standalone node, to send tokens between accounts. If you haven’t already set up your own local dev node, refer to this tutorial or follow the instructions in the GitHub repository.
This tutorial was created using the v3 release of Moonbase Alpha. The Moonbeam platform, and the Frontier components it relies on for Substrate-based Ethereum compatibility, are still under very active development. The examples in this guide assume an Ubuntu 18.04-based environment and will need to be adapted accordingly for MacOS or Windows.
You can interact with Moonbeam in two ways: using Substrate RPC endpoints, or by using Web3-compatible RPC endpoints. The latter endpoints are currently being served from the same RPC server as the Substrate RPCs. In this tutorial, we will use the Web3 RPC endpoints to interact with Moonbeam.
Install the MetaMask Extension¶
First, we start with a fresh and default MetaMask installation from the Chrome store. After downloading, installing and initializing the extension, follow the "Get Started" guide. In there, you need to create a wallet, set a password, and store your secret backup phrase (this gives direct access to your funds, so make sure to store these in a secure place). Once completed, we will import the development account:
The details for the development account that comes pre-funded for this standalone build are as follows:
- Private key:
- Public address:
On the import screen, select “Private Key” and paste in the key listed above:
You should end up with an imported “Account 2” that looks like this:
Connect to the Local Moonbeam Node¶
Now let’s connect MetaMask to our locally running Moonbeam node, which should be producing blocks:
If so, in MetaMask, navigate to Settings -> Networks -> Add Network and fill in the following details:
- Network Name:
- New RPC URL:
- Symbol (Optional):
When you hit "save" and exit the network settings screen, MetaMask should be connected to the local Moonbeam standalone node via its Web3 RPC, and you should see the Moonbeam dev account with a balance of 1208925.8196 DEV.
Initiating a Transfer¶
Let’s try sending some tokens with MetaMask.
For simplicity, we will transfer from this dev account to the one created while setting up MetaMask. Consequently, we can use the “Transfer between my accounts” option. Let’s transfer 100 tokens and leave all other settings as they are:
Once you have submitted the transaction, you will see it “pending” until it is confirmed, as shown in the following image:
Note that the Account 2 balance has been decreased by the sent amount + gas fees. Flipping over to Account 1, we see the 100 sent tokens have arrived:
If you end up resetting your standalone node using the Substrate purge-chain command, you will need to reset your MetaMask genesis account using Settings -> Advanced -> Reset Account. This will clear the transaction history from your accounts and reset the nonce. Make sure you don’t erase anything you want to keep!
We Want to Hear From You¶
This is obviously a simple example, but it provides context for how you can start working with Moonbeam and how you can try out its Ethereum compatibility features. We are interested in hearing about your experience following the steps in this guide or your experience trying other Ethereum-based tools with Moonbeam. Feel free to join us in the Moonbeam Discord here. We would love to hear your feedback on Moonbeam and answer any questions that you have.