01.03.2023
edit
npm init -y
npm install --save-dev hardhat
run below command in terminal -> choose create
a javaScript project -> SPAM ENTER
for all other options.
Terminal
npx hardhat
note: whenever you compile/run your smart contract, hardhat automatically gets the required version downloaded + installed for you -- pretty cool right!
node_modules
- all the magical spells of Hardhat reside herecontracts
- smart contracts are written herescripts
- deployment scripts are made heretest
- testing scripts go herecreate a file -- Hello.sol in contracts
folder -- then, copy + paste the following code.
./contracts/Hello.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "hardhat/console.sol";
contract Hello {
string public message = "Hello World";
function getMessage() public view returns (string memory) {
return message;
}
}
Solidity
extension in VS code by Juan Blanco from here -- it will help in debugging + developing faster.write
smart contracts? -- check this out.you have a hardhat project all set up, damn! -- before doing some magical stuff with it, you actaully need to know how it all works, right? -- click here to expose Hardhat's magical tricks happening under the hood.