Deploying and verifying smart contracts
So far, we have used npx hardhat run scripts/deploy.js
to deploy the smart contract. Now, we will see in detail how hardhat
run
works.
hardhat run
is a command used to call a JavaScript or a TypeScript to deploy smart contracts on the blockchain. It is part of the Hardhat suite, which is a development framework for Ethereum smart contracts. Hardhat simplifies the deployment process by automating several tasks, such as contract compilation, contract migration, and contract address management.
Here is a step-by-step explanation of how Hardhat deployment works:
- Compiling the smart contracts: Before deploying the smart contracts, they need to be compiled into bytecode, which can be executed by the EVM. Use the Hardhat compiler to compile the smart contracts in the
contracts/
directory. - Creating a deploy script: The deploy script is usually placed in the
scripts/
directory and has a filename in thedeploy.js
format. - Connecting...