npm
project.Create a basic sample project
option. This will provide you with a preset basic Hardhat project structure with simple smart contracts, tests, and example scripts.@nomiclabs/hardhat-waffle
and @nomiclabs/hardhat-ethers
. Both of these packages are useful during development and should be installed.sample project
setup option installs a sample contract named Greeter.sol
which can be seen below.Greeter.sol
contract allows the deployer to set a greeting string, deploy the contract, and later either change or return the set greeting. You can also add your own contracts.hardhat.config.js
as the configuration file. The config file allows you to define deployment networks, tasks, compilers, etc.hardhat.config.js
file to configure deployments to either the quaitestnet
or a local instance of Quai ropsten.
url
and chainId
variables should be set based on the chain you plan on deploying to. The corresponding port and chainId
for each chain can be found at here. hardhat.config.js
with your privKey
to fund contract deployment.Keystore
, create a new javascript file and copy the content below. Provide your keystore
and provider_url.
Run the script using node getPrivateKey.js
. privKey
variable from a separate, private file rather than placing it directly into hardhat.config.js
for best account safety practices.npx
in the CLI. Support for older solc compilers can be found here.sample-script
in the scripts
directory. sample-script.js
, we can set the initial greeting and log out the contract address upon deployment. Scripts can be used to automate many different functions other than deployment.Greeter.sol
to the network of your choice, run: