# learn-contract **Repository Path**: wang_renjia/learn-contract ## Basic Information - **Project Name**: learn-contract - **Description**: 智能合约学习-仅个人学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-03-15 - **Last Updated**: 2022-06-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # learn-contract #### 介绍 智能合约学习 #### 项目说明(hardhat框架) artifacts 相关合约编译后的json文件 cache 编译缓存 contracts 合约文件夹 scripts 部署相关文件夹 test 合约测试 hardhat.config.js 项目部署配置文件 #### 常用命令 1.初始化空项目:npm init 2.安装hardhat:npm install --save-dev hardhat 3.配置本地启动节点:npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers 4.运行hardhat:npx hardhat 5.引入@openzeppelin插件: npm install @openzeppelin/contracts@4.4.0 npm install @openzeppelin/contracts-upgradeable@4.4.0 6.编译文件:npx hardhat compile 7.清除已编译缓存:npx hardhat clean 8.执行测试用例:npx hardhat test 9.新启动一个终端窗口,启动本地节点:npx hardhat node 设置启动地址及端口号方式启动节点:npx hardhat node --hostname 192.168.1.28 --port 9090 10.本地部署合约(仅查看是否部署成功):npx hardhat run scripts/deploy.js 部署合约到指定节点:npx hardhat run scripts/deploy.js --network 节点名称(hardhat.config.js中配置) #### 浏览器编辑器: 1.基于以太坊 remix https://remix.ethereum.org/#optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js 2.基于波场 tronide http://www.tronide.io/?#ideVersion=v0.4.5&optimize=true&version=soljson_v0.8.0+commit.7c2e641.js #### 水龙头 1.以太坊:metamask => 购买 => 测试水管 https://tokenbb.com/lists/faucets 2.波场:https://nileex.io/join/getJoinPage 3.币安:测试水管:https://testnet.binance.org/faucet-smart