Build a Web3 App with Solidity + Ethereum Smart Contracts section01 notes

Get your local Ethereum networking running | 部署本地 Ethereum 环境

1. 安装 node

2. 安装 nvm:

nvm 安装与使用(详细步骤) — 掘金

2. Setting up the environment | Hardhat | Ethereum development environment for professionals by Nomic Labs

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
nvm install 16 ## 需要重新打开terminal 运行
nvm use 16
nvm alias default 16
npm install npm --global # Upgrade npm to the latest version

3. 安装 hardhat

mkdir my-wave-portal
cd my-wave-portal
npm init -y
npm install --save-dev hardhat

4. Get sample project going

npx hardhat ## Choose the option to create a sample project. Say yes to everything.
npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers ## Go ahead and install these other dependencies just in case it didn't do it automatically.
npx hardhat accounts
post image
post image

5. 🌟 Run it

npx hardhat compile
npx hardhat test
post image

6 delet it

Go ahead and delete the file sample-test.js under test. Also, delete sample-script.js under scripts. Then, delete Greeter.sol under contracts. Don’t delete the actual folders!

post image

7 summary

这一课是在电脑本地安装你的 ETH 编程环境,你需要安装 git,nvm,node 和 hardhat,这一课我踩了不少坑,如果你网好,没有选择错,或许你会比我顺利。对了,如果你安装 nvm 和 hardhat 中遇到了问题,或者无法卸载 node,直接删除 nvm,node 的文件夹重新安装即可。