With Hardhat
Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
Setting up the development environment
There are a few dependencies to install before we start. Please install the following:
Node.js v8+ LTS and npm (comes with Node)
Do ensure that your npm modules have been added to your path
After installing the above dependencies, we can proceed to install hardhat:
To create your Hardhat project, run this command while you are in the project's root folder:
Return (choose the most appropriate option):
Let’s create the sample project and go through these steps to try out the sample task and compile, test and deploy the sample contract.
The sample project will ask you to install hardhat-waffle
and hardhat-ethers
, which makes Hardhat compatible with tests built with Waffle. You can learn more about it in this guide.
Hardhat will let you know how, but, in case you missed it, you can install them with
npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers
hardhat-config
After setting up your truffle project, be it cloning a repository or initializing a new hardhat project
Open
hardhat-config.js
Edit
hardhat-config.js
with f(x)Core network credentialsCreate a .env file to store your private key of that corresponding wallet address
The files below are just an example, feel free to rename your variables:
if you have not already installed dontenv, please do so by running the following command:
Compile Smart contract file
Deploying on f(x)Core Network
Run this command in root of the project directory:
Contract will be deployed on f(x)Core network, it will look something like this:
Remember your address would differ, the above is just to provide an idea of structure. Congratulations! You have successfully deployed Greeter Smart Contract. Now you can interact with the Smart Contract.
You can check the deployment status on Testnet.
Last updated