# Goshen 测试网交互 教程

By [cryptocat](https://paragraph.com/@cryptocat-2) · 2022-10-14

---

**特别鸣谢亏club GM365老师，仅供亏友们学习。**

**第一步： 打开Goshen 测试网桥**

这里我们要把测试ETH从Goerli 测试网跨到Goshen的测试网。

[https://bridge.goshen.network/](https://bridge.goshen.network/)

首先你需要有 Goerli测试网的测试Eth。

**这里强烈推荐注册一个alchemy的账号**，通过alchemy官方的水龙头领取Goerli的测试币

[https://goerlifaucet.com/](https://goerlifaucet.com/)

（同时，有了alchemy账号后，可以顺手把小狐狸的rpc都改成自己alchemy账号的rpc，万一后面空投了呢 XD

官方教程

[https://docs.alchemy.com/docs/how-to-add-alchemy-rpc-endpoints-to-metamask](https://docs.alchemy.com/docs/how-to-add-alchemy-rpc-endpoints-to-metamask)

）

**第二步：领取了alchemy水龙头之后，切换到Goerli测试网就可以进行跨链到测试网的操作**

点击 deposit，等待交易打包上链。这里我试了几次，会有失败的交易。失败了也没关系，多试几次就行。

![](https://storage.googleapis.com/papyrus_images/b10bd24f099a19cbe0a9b158d1fa6f098749c04bd6ddd41fc9e593b1a66e1b83.png)

**第三步：添加测试网rpc**

把测试网rpc添加到小狐狸后，等待一段时间eth成功跨到测试网

![](https://storage.googleapis.com/papyrus_images/6fc64c4a01b72eedadfa6c417bb09257fe2825ace5d5f685ce8429415d3f9240.png)

![](https://storage.googleapis.com/papyrus_images/cb552dd4d4e5cfb9c6293be91e5843e294b66d63a70b01a70904659da1daa27d.png)

看见测试网有余额了就表示跨链成功了。

**第四步：测试网部署合约**

先不着急跨回来，可以在测试网部署一个最简单的合约。利用remix网站可以轻松完成上链部署。

[https://remix.ethereum.org/](https://remix.ethereum.org/)

首先新建一个helloworld.sol文件

![](https://storage.googleapis.com/papyrus_images/2b918d3102f9cfb55b02a021a20820f2fcbfb02a4180b8f8da16037cb8f80b71.png)

在.sol文件内复制以下合约代码后保存

    // SPDX-License-Identifier: MIT
    // compiler version must be greater than or equal to 0.8.13 and less than 0.9.0
    pragma solidity ^0.8.13;
    
    contract HelloWorld {
        string public greet = "hello world!";
    }
    

点击左侧第三个编译按钮，选择对应solidity版本0.8.13进行编译

![](https://storage.googleapis.com/papyrus_images/533a37fc671429e687fd5a4149406e8728d87b796eea893553196510c258205d.png)

出现绿色对勾表示编译完成。

点击左侧第四个发布按钮，选择通过小狐狸发布上链

![](https://storage.googleapis.com/papyrus_images/c7c970a9c96d315115bde25ec6f0d897369080bdeee41360de6bdd6453b6a11b.png)

链接小狐狸后，点击deploy，小狐狸点击确认发布合约。

**第五步：验证并开源合约代码**

通过Goshen测试网浏览器找到之前部署的合约（这个可能要等一会，浏览器显示部署的合约可能需要个一两分钟）

[https://explorer-testnet.goshen.network/](https://explorer-testnet.goshen.network/)

![](https://storage.googleapis.com/papyrus_images/ce2a745e0d4451e8a108ee3ee53509956ef68a594b461d1751fd6542bba5bc89.png)

![](https://storage.googleapis.com/papyrus_images/41cc8478dbe6ff2622002e7392dbda66da88130690120c486cf986715b44ee73.png)

![](https://storage.googleapis.com/papyrus_images/d9ec3d0d4c1b3b68386b1d9e6aad7fc82fcb553a04591c590d1ebaf86ebb9de9.png)

选择通过源码开源

![](https://storage.googleapis.com/papyrus_images/f5c032a7d688cf1b4aa23ade2034c5f33fc3f80206e369ad42dfaa9d929c2ca5.png)

填写合约名称，选择对应的solidity版本，复制粘贴代码，点击发布。完成！

**第六步：剩余的Eth跨回Goerli 测试网**

![](https://storage.googleapis.com/papyrus_images/1d82db6ce79406eba0775a4d352c77316cbc788481f5cd4bbda05a6fc5f15441.png)

大功告成。

---

*Originally published on [cryptocat](https://paragraph.com/@cryptocat-2/goshen)*
