Using Hardhat
Last updated
Last updated
Hardhat is an Ethereum development environment. It could interact with Ethereum's API and then deploy smart contracts into the Rangers Protocol. The following content introduces how to configure hardhat on your device, and how to compile and deploy smart contracts.
Note: If you are a Windows user, it is highly recommended to use the Windows Subsystem for Linux (as known as WSL2) for a better operating experience.
The following tutorial is based on Ubuntu and guides you through the process of successfully setting up a hardhat project and deploying smart contracts on Rangers Protocol.
Using hardhat to access Rangers Protocol is also a good option. Before installing hardhat, Make sure you have git and node.js installed. Otherwise follow this instruction.
Git
Node.js
Once you have these fundamental applications installed, create a new folder that is the running space for the Hardhat project.
Initialize an npm project as shown below.
In the terminal, go to the new folder and use the npm package manager to install hardhat, enter the command:
Once installed, run the hardhat project in the same directory and enter the command:
After opening “hardhat.config.js”, copy the following code to update “hardhat.config.js”, they will allow you to interact with Rangers Protocol and test your contract.
Note:Please choose the appropriate solidity version. You could attain more information about Rangers network configuration on https://doc.rangersprotocol.com/network.html
Create a .env file to store your private key . You can follow Export private key
Compile smart contract
Deploy smart contract
You can check Rangers scan later to verify if your contract is successfully deployed on Rangers protocol.
Congratulations on completing your first hardhat deployment of a smart contract!!