使用 Hardhat 部署 HelloWorld 合约
先决条件
创建HelloWorld代码设置
mkdir create-helloworld-contract-using-hardhat;
cd create-helloworld-contract-using-hardhat;# FROM ./create-helloworld-contract-using-hardhat;
npx hardhat init;
# [Expected Prompts]:
# 888 888 888 888 888
# 888 888 888 888 888
# 888 888 888 888 888
# 8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
# 888 888 "88b 888P" d88" 888 888 "88b "88b 888
# 888 888 .d888888 888 888 888 888 888 .d888888 888
# 888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
# 888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888
#
# 👷 Welcome to Hardhat v2.18.3 👷
#
# ✔ What do you want to do? · Create a TypeScript project (with Viem)
# ✔ Hardhat project root: · /path/to/create-helloworld-contract-using-hardhat
# ✔ Do you want to add a .gitignore? (Y/n) · y
# ✔ Do you want to install this sample project's dependencies with npm (hardhat @nomicfoundation/# hardhat-toolbox-viem)? (Y/n) · y创建HelloWorld合约
测试HelloWorld合约
为Berachain合约部署配置Hardhat
在Berachain部署HelloWorld合约
终端 1:部署合约
终端 2:运行本地节点
验证HelloWorld合约
完整代码库
最后更新于