- First, you need a tool for scientific internet access, which costs 6 yuan per month and is very useful.
https://mxwljsq.com/user/shop - Install WSL, WSL is the Windows Subsystem for Linux, open PowerShell with administrator privileges, and do it all at once.
- Install vscode, the tool for writing code, install the plugin, click on the small icon in the lower left corner, and connect to WSL.
- Install curl, curl is a command-line file transfer tool.
- Install nvm, nvm can be used for version control of nodejs.
- Install nodejs, nodejs is the environment for JavaScript.
If you are using hardhat or editing solidity files in vscode, you need to install the plugin, the yellow one supports hardhat.
Choose a development tool. The current mainstream development tools are: Remix, Truffle, Hardhat, Foundry.
Remix: The simplest development tool, very suitable for beginners to use, it has a complete GUI function, which can reduce a lot of code.
Truffle: The oldest development tool, compared with Remix, it is installed locally and does not require network support, and it also has a GUI.
Hardhat: It is currently the most popular development framework, also installed locally, without GUI, and more flexible than Truffle.
Foundry: It is an emerging development framework, used for the best flexibility. For beginners, if you only focus on the contract itself and do not need to learn JavaScript, you only need to learn the solidity language.
Steps to use hardhat:
- Initialize a project.
- Install hardhat (the old version's interaction and contract deployment methods may have been invalidated).
- Initialize the hardhat project.
- Install dependencies.
@openzeppelin/contracts erc20, erc21 standards, etc.
@openzeppelin/contracts-upgradeable upgradeable erc20, erc721, etc.
@chainlink/contracts used for random number requests, contract automation execution, etc.
dotenv stores important information.
@nomiclabs/hardhat-ethers used for contract deployment.
@openzeppelin/hardhat-upgrades used for deploying proxy contracts.
@openzeppelin/hardhat-defender used for contract security protection.
@nomiclabs/hardhat-etherscan automatically verifies on the blockchain browser after deploying the contract.
chai contract testing.
@openzeppelin/test-helpers openzeppelin team's contract testing.
- Create a .env file to store critical information.
- Modify hardhat.config.js
- Use the Wizard to develop contracts https://docs.openzeppelin.com/contracts/4.x/wizard
- Compile the contract.
- Deploy the contract script (ethers6.0 may not be applicable).
- Start the hardhat local network.
- Deploy to the hardhat local network.
- Deploy to the sepolia testnet.