# hardhat-tutorial **Repository Path**: cekongsb/hardhat-tutorial ## Basic Information - **Project Name**: hardhat-tutorial - **Description**: No description available - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-31 - **Last Updated**: 2025-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 备注:大额地址私钥 32630e2a886428718d198f3f1e4df156918e995a9026967b632f8a750765ed2b 1.环境搭建 安装nodejs环境,通过nvm install 2.创建新的hardhat项目 (1)初始化项目目录,并安装hardhat mkdir hardhat-tutorial cd hardhat-tutorial npm init npm install --save-dev hardhat (2)创建项目目录结构 npx hardhat 3.编写和编译合约 (1)在项目目录新建目录contracts,新建合约文件Token.sol (2)编译合约 npx hardhat compile 4.测试合约 在项目目录新建目录test,新建测试文件Token.test.js npx hardhat test 5.部署合约 (1)在项目目录新建目录scripts,新建部署脚本文件deploy.js (2)在hardhat.config.js文件中添加一个network条目 npx hardhat run scripts/deploy.js --network npx hardhat run scripts/deploy.js --network roos npx hardhat run scripts/deploy.js --network testnet 6.使用 ethers.js 调用合约 npx hardhat run scripts/interact.js --network roos npx hardhat run scripts/interact.js --network testnet 7.使用 transfer.js 调用合约 npx hardhat run scripts/transfer.js --network roos npx hardhat run scripts/transfer.js --network testnet