# 第八周教程 **Published by:** [Chan](https://paragraph.com/@chans97/) **Published on:** 2022-09-21 **URL:** https://paragraph.com/@chans97/IaT7Bex2dc2XU4fNzxAp ## Content step 1 本地电脑执行程序 1.找到hardhat.config.js文件,将里面的私钥替换成你的钱包私钥,及的保存 2.把artifacts和cache这两个文件夹删掉 3.在Terminal里面输入下面的命令部署合约到测试网 yarn hardhat console --network goerli 3.我们等待合约部署完成,然后输入下面命令 signer = await ethers.getSigner(); 4.完成以后接着输入下面命令 balance0 = await ethers.provider.getBalance((await ethers.getSigner()).address) 5.成功以后输入下面命令 factory = await ethers.getContractFactory("Casino") 6.接着输入 casino = await factory.deploy() 7.然后分别(一条条输入)输入下面命令 const valA = ethers.utils.keccak256(0xBAD060A7) const hashA = ethers.utils.keccak256(valA) const valBwin = ethers.utils.keccak256(0x600D60A7) tx1 = await casino.proposeBet(hashA,{ value: 1e5}) 8.稍微等待一段时间,需要等proposeBet执行完成,再输入命令 tx2 = await casino.acceptBet(hashA, valBwin, {value: 1e5}) 9.等待一段时间以后,进入 https://goerli.etherscan.io/address/{私钥对应地址} 查看你的交易记录,如果有如图所示的交易记录,就说明成功了。 step 2 填表 填表的证明可以用https://goerli.etherscan.io/address/{私钥对应地址} 用你地址交易记录里面创建合约的记录点进去就是合约地址,用合约地址提交。 ## Publication Information - [Chan](https://paragraph.com/@chans97/): Publication homepage - [All Posts](https://paragraph.com/@chans97/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@chans97): Subscribe to updates