visit
Don't miss out on valuable insights into the world of Web3 development! , you'll have access to a wide range of educational videos that can help take your skills to the next level. And if you're interested in connecting with me personally, be sure to , and I offer. Join me on this exciting journey of Web3 development and let's unlock its full potential together!
STEP 1: Setting Up Project Structure
Create a project named **freeTestEthers**
, this could be any JavaScript-based project such as NodeJs, ReactJs, VueJs, or even a NextJs project. For this example, we will do a NodeJs project.
cd freeTestEthers
npm init --y
STEP 2: Creating Hardhat Project Install the Hardhat packages that enable you to run a blockchain server, on the terminal, run the following commands:
npm install hardhat
npx hardhat
STEP 3: Running Hardhat Server On completion of the installation, again run this command to spin up the Hardhat blockchain server:
npx hardhat node
The above command should spin up a server looking like the one in the image above. Please observe the difference between the accounts and their private keys. We will later use the private keys to import Ethers to Metamask.
STEP 4: Accessing Metamask With Metamask already installed, open your browser and visit the following link which will open up your Metamask extension interface in full. It should look like the image below.
chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#
STEP 5: Configuring Network
We now tell Metamask to use the Hardhat server running on step 3 of this section.
Did you notice the network configuration in the image above?
STEP 6: Importing Accounts From step 3, copy the first private key for the account zero (0) as can be seen in the following image.
Now, ensure that you select Localhost as your preferred network and click on the “import account” button as can be seen in the image below.
Congratulations, you have been able to import a new account using its private key, now compare how through the private key account 5 address is the same as the one in the image below.
STEP 1: Installing Ganache Server To Install Ganache globally on your machine, run the following command on your terminal:
npm install ganache --global //or
sudo npm install ganache --global
STEP 2: Running Ganache Server On completion of the installation, run the command below to spin up the Ganache blockchain server:
ganache -d
A server that resembles the one in the image above should be created using the aforementioned command. Please pay attention to how the accounts and their private keys differ. The private keys will eventually be used to import Ethers into Metamask just as we did with Hardhat.
STEP 3: Configuring Network Once more, we must instruct Metamask to connect to the Ganache server that is active in this section's step 3. This time, a brand-new network will be added from scratch.
Now it should be known that the only difference between Hardhat and Ganache servers is their chain Id. While Hardhat has a 31337 chain id, Ganache has 1337. Ensure that you click the save button to add it to your network list.
STEP 4: Importing Accounts From step 3, copy the first private key for the account zero (0) as can be seen in the following image.
Now, ensure that you select Localhost as your preferred network and click on the “import account” button as can be seen in the image below.
You can import accounts into your Metamask wallet in this manner. Doing this procedure now will allow you to import more Ganache server accounts.
Don't miss out on the opportunity to become a sought-after smart contract developer! , and gain the skills and knowledge you need to excel in this exciting field. And while you're at it, be sure to to stay up to date with the latest web3 development videos.
Gospel Darlington is a full-stack blockchain developer with 7
years of experience in the software development industry.