姓名: 张宏伟
学号: 3190105029
- 操作系统: Windows 10
- IDE: VS Code
- 浏览器: Chrome
- npm 8.1.0
- node v14.17.0
- yarn 1.22.10
- Truffle v5.4.15
- Solidity v0.5.16
- web3.js v1.5.3
- ipfs 0.10.0
-
配置node,npm,yarn , 安装truffle、ganache,在Chrome浏览器,安装插件MetaMask
-
打开Ganache,选择quickstart,将server的端口号改成8545,配置完毕后,点击右上角save and start
-
进入demo文件夹下的client文件夹,依次输入命令
truffle compile
truffle migrate
-
将
truffle migrate
后的结果中的‘myNft' 中的contract address 复制,
然后复制到client/src/getWeb3.js文件,将第6行的address变量的值设置为刚刚复制的地址
- 在client目录下输入npm start启动项目,然后在google浏览器中访问http://localhost:3000
- 登陆MetaMask,连接localhost:8545的本地网络,并且从Ganache中导入几个账户,将账户同http://localhost:3000进行连接。 然后即可使用