How to add Custom Network to Metamask

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 an…


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,

Metamask Preview

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;

Add New Network

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

Adding Network

After you saved that, you can see something like this;

Network added

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;

Ganache CLI

Click quickstart and you have everything you need.

Ganache CLI - In Depth

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.

Ganache private key

Do not ever use test accounts in real blockchain

anache Private Key Modal

Copy that private key and click on the Metamask extention again. Go profile > import account and you will see this screen;

Import Account to Metamask

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.

Labeled as Imported

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.

Three Dots

This should open a modal which you see the account information

Account Info

From there just click the pencil icon and change the name whatever you want. And save it.

Saving the Name

Now you should see the updated names in myAccounts section

MyAccounts tab

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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » How to add Custom Network to Metamask." DEV Community | Sciencx - Saturday March 12, 2022, https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/
HARVARD
DEV Community | Sciencx Saturday March 12, 2022 » How to add Custom Network to Metamask., viewed ,<https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/>
VANCOUVER
DEV Community | Sciencx - » How to add Custom Network to Metamask. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/
CHICAGO
" » How to add Custom Network to Metamask." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/
IEEE
" » How to add Custom Network to Metamask." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/12/how-to-add-custom-network-to-metamask/. [Accessed: ]
rf:citation
» How to add Custom Network to Metamask | DEV Community | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.