This content originally appeared on DEV Community and was authored by DEV Community
Hello guys, this will be a post where I will show you how to add custom local network to Metamask.
This article assumes that you already installed metamask and you have been created an account before. If you don't installed yet, go to Metamask and download it to your browser.
Interacting with Metamask
Click on the extension and go the settings,
if you scroll down a little bit, you will see network option. Click on that and press add network button. This should open a form in the new tab.
It should be something like this;
Adding Custom Network
In our tutorial, we will add custom local network to metamask. Ganache or Hardhat can be an example for that.
If you want to add other EVM compatible networks, you can also do that!
Network Name: Localhost:7545
New RPC URL: http://localhost:7545
Chain Id: 1337
Currency Symbol: ETH
After you saved that, you can see something like this;
Wait, whaaat! I can't see my ETH in there. Don't freak out :) It is because we do not imported our local accounts that node gives us.
Installing Ganache
For this tutorial you need to install ganache in order follow along. Go to Ganache and download the CLI.
After you installed it you can run the CLI on your machine.
You should see something like this;
Click quickstart and you have everything you need.
Importing Accounts to Metamask
What we need to grab the private key of one of our test accounts and import it to Metamask.
For Ganache, you can grab it inside it Ganache CLI, for hardhat and other nodes, you can copy them right through the console once you start the node in your terminal.
Click the show keys account that is inside accounts tab. It will open a modal and you grab private key from there.
Do not ever use test accounts in real blockchain
Copy that private key and click on the Metamask extention again. Go profile > import account and you will see this screen;
and.. paste that private key to that input and click import.
You should see that your active account is changed and it is labeled as imported. And you can also see that it contains test balances inside of the account.
Great!! Now you can build your dream application and test using local nodes.
(Optional) - Labeling the Account
Metamask also offers labeling the account so that if you use it for development it will be easier to differenciate them from real accounts.
Once you clicked the extension again, click the three dots and go to account details.
This should open a modal which you see the account information
From there just click the pencil icon and change the name whatever you want. And save it.
Now you should see the updated names in myAccounts section
And that is all from my side! Thank you so much for reading this far, and if you want to learn more topics like this feel free to subscribe my youtube channel which I started last week!
That's all and have a wonderful day :)
This content originally appeared on DEV Community and was authored by DEV Community
DEV Community | Sciencx (2022-03-12T19:07:21+00:00) How to add Custom Network to Metamask. Retrieved from https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.