# 【财富密码】analog 部分功能上分教程

By [VICOINDAO](https://paragraph.com/@vicoindao) · 2024-06-10

---

该项目任务繁多且复杂,目前测试网卡加bug多多，偏向技术开发人员。有能力的或看好它的撸，不感兴趣的忽略。。。

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

1、GMP相关(目前测试网验证还存在bug,可以等稳定了再试)

原作者教程

[https://medium.com/\[@4mo4ever\](https://weibo.com/n/4mo4ever)/analog-gmp-quests%E6%95%99%E7%A8%8B-cc327a50af31](https://medium.com/%5B@4mo4ever%5D\(https://weibo.com/n/4mo4ever\)/analog-gmp-quests%E6%95%99%E7%A8%8B-cc327a50af31)

remix：emix.ethereum.org/

①打开remix在线合约部署编译平台，打开默认项目，点开项目中的contracts目录，鼠标右键随便创建一个.sol的空白文件

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

②复制以下代码到创建的文件中

// SPDX-License-Identifier: MITpragma solidity ^0.8.0;interface IGmpReceiver {/\*\*\* [@dev](https://weibo.com/n/dev) Handles the receipt of a single GMP message.\* The contract must verify the msg.sender, it must be the Gateway Contract address.\*\* [@param](https://weibo.com/n/param) id The EIP-712 hash of the message payload, used as GMP unique identifier\* [@param](https://weibo.com/n/param) network The chain\_id of the source chain that send the message\* [@param](https://weibo.com/n/param) source The pubkey/address which sent the GMP message\* [@param](https://weibo.com/n/param) payload The message payload with no specified format\* [@return](https://weibo.com/n/return) 32-byte result, which will be stored together with the GMP message\*/function onGmpReceived(bytes32 id, uint128 network, bytes32 source, bytes calldata payload)externalpayablereturns (bytes32);}contract Counter is IGmpReceiver {// sepolia 0xB5D83c2436Ad54046d57Cd48c00D619D702F3814// shibuya 0xF871c929bE8Cd8382148C69053cE5ED1a9593EA7address private immutable \_gateway;uint256 public number;constructor(address gateway) {\_gateway = gateway;}function onGmpReceived(bytes32, uint128, bytes32, bytes calldata) external payable override returns (bytes32) {require(msg.sender == \_gateway, "unauthorized");number++;return bytes32(number);}}

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

③编译运行合约

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

④在左侧工具菜单栏中找到部署按钮，并将环境选择小狐狸，将小狐狸钱包的网络切换为sepolia测试网，网络不要搞错了,再链接小狐狸钱包并签名、授权

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

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

⑤在黄色的deploy 右边地址栏输入

0xB5D83c2436Ad54046d57Cd48c00D619D702F3814 之后点击deploy部署

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

⑥ 部署成功后复制合约地址到sepolia区块浏览器[https://eth-sepolia.blockscout.com/](https://eth-sepolia.blockscout.com/)

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

⑦ 在区块浏览器中链接自己的钱包、搜索自己部署的合约、点击右下方contract经行开源

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

⑧点击verify&publish按钮并按以下要求填写合约的信息

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

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

如图填写

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

最后点击verify&publish 进行验证及开源

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

⑨将开源的合约地址复制到页面填入点击claim就可以了\\

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

第二个问题比较简单，在区块浏览器中写合约。按原作者的第二种方式操作即可

[https://sepolia.etherscan.io/address/0xB5D83c2436Ad54046d57Cd48c00D619D702F3814#writeContract](https://sepolia.etherscan.io/address/0xB5D83c2436Ad54046d57Cd48c00D619D702F3814#writeContract)

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

最后将交易的hash id 复制到页面中填入进行验证即可

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

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

2、投票

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

3、到dc/gitHub反馈你遇到的问题

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

**​好的，今天就分享到这里了，感兴趣的朋友请关注我们！**

**微信1：victeam005**

**微信2：shijie20170405**

Twitter：[https://twitter.com/VICOINDAO](https://weibo.cn/sinaurl?u=https%3A%2F%2Ftwitter.com%2FVICOINDAO)

---

*Originally published on [VICOINDAO](https://paragraph.com/@vicoindao/analog)*
