Solidity smart contract deployment using hardhat
Last updated
Last updated
There are three steps involved in the contract deployment using Hardhat,
Create a new Hardhat project
Configure Hardhat project with targeted blockchain
Compile and deploy
Visual Studio - VS code
Hardhat
A) Setup the Hardhat environment in the VS code:
Follow the step-by-step procedure explained in the tutorial provided by Hardhat,
Now, the VS code will be installed with Hardhat framework and ready to begin with smart contract deployment.
The steps to deploy smart contract using Hardhat is explained below,
Login to the VS code environment which has the Hardhat framework installed with necessary files and folders to access.
Next, OpenZeppelin is an external library which should be present in VS code for contract deployment and it can be installed using below command:
The TEST_ERC20.sol
is the script provided by OpenZeppelin library to provide the desired minting value.
There are two files used for contract deployment
A. hardhat_config.ts - Config file
B. deploy_config.ts - Deploy script
Example script structure is provided below:
The user has to provide the account's private key for accounts
value in the hardhat_config
file.
Ethers library is provided by Ethereum and it has the necessary functions required for calls. Deploy script is required to deploy smart contract.
The command to deploy contract is given below:
The contract address will be generated with deployment successful message.
Solidity smart contract deployment using Hardhat is successful! ✅