Create an empty hardhat.config.js. Now, let’s configure the file.
hardhat.config.jsfile to assign the Solidity version and RPC server. In my case I use Visual Studio Code.
private.json, where we store the private key. Never reveal your private key. The private.json looks like this:
HelloWorld.solfile, and be sure to read the comments to understand what this contract does:
HelloWorld.sol, uses Solidity 0.8.1. Make sure the Hardhat configuration file (
hardhat.config.js) is correctly set up with this solidity version. When everything meets the criteria, we can compile the contract by running:
deploy.js, adding the following contents to it:
ethers.jsis an abstraction used to deploy new smart contracts, so HelloWorld here is a factory for instances of our
hello worldcontract. When using the
hardhat-ethersplugin ContractFactory and Contract instances are connected to the first signer by default.
deploy( )on a
ContractFactorywill start the deployment, and return a
Promisethat resolves to a
Contract. This is the object that has a method for each of our smart contract functions.
HelloWorldcontract to Dusty: