📖GOGO 房地产
type
status
date
slug
summary
tags
category
icon
password
准备
- 检查是否安装node.js(注意:本项目node -v 是16.14.0)
- 安装项目依赖npm install
RealEstate.sol
- 导入:
- 合约名 is ERC721URIStorage
- 粘贴:
- 铸造币:
- 总供应量:
Escrow.sol
代码:
测试
- test → Escrow.js
- 代码:
- 终端:npx hardhat test
Escrow.js
- 测试代码:
结果有20个账户
- 设置账户
- mint
- 更改代码:
- 更改代码:
list
Escrow.sol
- 3的public改为public payable onlySeller
Escrow.js
- 更改:
Earnest deposit
- Escrow.sol
- Escrow.js
Finish contract
Escrow.sol
Escrow.js
- 更改:
Deploy contracts
- 启动节点:npx hardhat node
- scripts → deploy.js
- npx hardhat run scripts/deploy.js --network localhost
- 测试:在deploy.js中加入代码
运行节点,部署脚本后,终端显示的合约地址与src/config.json中一致
创建前端
- 打开页面:npm run start
- 添加网络:
Hardhat
31337
ETH
连接区块链
- 在npx hardhat node下找到前五个私钥,添加到metamask账户,命名为hardhat 0~4
- App.js
- 更改:
导航栏
Navigation.js
App.js
搜索栏
- App.js
list properties
- 测试
3.
Buy property
- 更改:
- Home.js
- 更改:
- 更改:
- 更改:
- 更改:
上一篇
Smart-Contract-Lottery
下一篇
Solidity易混点
Loading...