Writing your first Solidity smart contract
Now that you have installed all the required tools, you can use them to develop your smart contracts. We will write a simple contract to increase and decrease the count stored in the contract.
To create a new Hardhat project, you can run the following commands:
mkdir Countercd Counter npx hardhat init
Then, choose the following option in the Hardhat menu, and leave all default selections for the prompts:
Create a JavaScript project
These commands will set up the required folder structure and some skeleton code for you to get started. The following figure shows you what to expect when you open the project in VS Code.
Figure 5.11 – A Hardhat example in VS Code
Your source code will be empty. Now, let us learn what code needs to be placed in these files and folders.
Here is a Solidity smart contract example that allows you to increment and decrement a count stored in the contract:
// SPDX...