Web3 Security Series: Can funds mistakenly transferred to other blockchains be recovered? | Bee Network
An EOA (Externally Owned Account) is what we commonly refer to as a regular wallet address that is directly controlled by a private key or mnemonic phrase.
Prerequisites for asset recovery:
You have transferred your assets to an EOA address. You possess the private key or mnemonic phrase for this target EOA address. (This is usually another wallet address of your own, or a friend’s address that they are willing to cooperate). The target chain is an EVM-compatible chain.Methods to recover assets:
The holder of the private key to the receiving EOA address can directly withdraw funds on the target blockchain.
2. Scenario 2: The receiving address is the contract.This is one of the most desperate scenarios. Because the smart contract’s address is not generated by the private key, no one owns the smart contract’s private key and therefore cannot control the contract in the same way they control the EOA. Furthermore, if the contract does not have a pre-written rescue function to handle “accidentally transferred assets,” the mistakenly transferred funds may be permanently locked in the contract, and no one can retrieve them.
However, in some cases, there is indeed a glimmer of hope. Next, we will construct a scenario where ETH is locked on the Ethereum mainnet, and then explain how to rescue the funds.
2.1. Scene IntroductionIn summary, this scenario involves a user intending to invoke a contract on the Sepolia testnet to transfer ETH into the contract for token minting. However, during the transaction initiation, an incorrect connection was made to the mainnet, resulting in the ETH being locked in the mainnet contract. The specific scenario construction process is as follows:
1. On the Ethereum Sepolia testnet, the project team (EOA) deployed an implementation contract . Assume the main function of this contract is for users to deposit ETH to mint corresponding A代币s, with code similar to the “mintTokens” function. Assume the deployment address is A. Note that there is no function in A that allows direct ETH withdrawal.
2. On the Ethereum Sepolia testnet, the project team (EOA) deployed a factory contract . This contract’s function is to deploy a proxy contract pointing to the implementation contract (as shown in the function “deployProxyByImplementation”) using minimal proxy contracts (Clones) based on the provided implementation contract address and salt. Assume the deployment address is B. Here, we call the “deployProxyByImplementation” function, passing the implementation contract A address as `_implementation`, to deploy a proxy contract pointing to A at address C.
3. A user wants to mint ATokens on the Sepolia testnet by transferring ETH. The user initiates a call to the proxy contract C. Normally, proxy contract C would further call the “mintTokens” function, which implements contract A, to complete the user’s operation. However, during the call, the user incorrectly connects to the Ethereum mainnet. Consequently, the user directly transfers ETH to address C on the Ethereum mainnet. At this point, no contract is deployed on address C on the Ethereum mainnet, and no one owns the private key for address C. Therefore, the user’s funds are temporarily locked in address C on the mainnet.
2.2. Key Knowledge PointsBefore introducing the specific rescue plan, let’s first introduce some basic knowledge points needed for rescue.
2.2.1. create & create2
`create` and `create2` are two common ways to deploy contracts in Solidity.
When deploying a contract using the `create` function, the contract address is determined by the address of the transaction initiator and the account’s transaction count (nonce), and is unrelated to the contract’s content. When deploying a contract using create2, the calculation of the contract address no longer depends on the transaction initiator’s nonce, but is related to the following four parameters. 0xff The contract address for creating a new contract. The obfuscation value (salt) used as a parameter The creation bytecode (init_code) of the contract to be created.2.2.2. Minimal Agent Contracts (Clones)
https://docs.openzeppelin.com/contracts/4.x/api/proxy#clonesMinimal proxy contracts, also known as clone contracts, are based on the idea of deploying a proxy contract with extremely low cost (Gas) that points to a specified implementation contract. In a clone contract, the proxy contract can be deployed using either the `create` or `create2` method. For example, deploying a proxy contract using the `cloneDeterministic` function employs the `create2` method.
In the “cloneDeterministic” function, the bytecode of the created proxy contract is very short, in the format: “0x363d3d373d3d3d363d735af43d82803e903d91602b57fd5bf3″. The address of the implementation contract is directly hard-coded into the bytecode, and all calls to the proxy contract are delegated to the implementation contract.
As can be seen from the “cloneDeterministic” function, it uses the create2 method to create a proxy contract. The address of the created proxy contract is related to the address of the contract creator, the salt, the address of the implementing contract, and a fixed string of bytecode, but it is unrelated to the bytecode of the implementing contract.
2.3. Rescue PlanNext, we’ll explain how to rescue a user’s ETH held in the mainnet C address. The main idea is to deploy contract code on the Ethereum mainnet C address to take over the address and extract the ETH. The specific steps are as follows:
1. Deploy a factory contract on the mainnet with the same address B as on the testnet. The reason for needing the same factory contract address is that when subsequently calling “cloneDeterministic” to deploy the proxy contract, the address calculation of the proxy contract is related to the factory contract address. By examining the transaction deploying the factory contract on the Sepolia testnet, obtain the nonce of the deployer (project address) in this transaction. On the mainnet, advance the nonce of the project owner’s (EOA) address to the nonce before deploying the factory contract. Then deploy the factory contract on the mainnet. Since the deployer’s address and nonce are the same as the deployment transaction on the testnet, the factory contract address deployed on the mainnet will also be B.
2. Deploy the implementation contract on the mainnet at the same address A as on the testnet. As mentioned in the #Minimum Proxy Contract (Clones)# section, deploying a proxy contract using the “cloneDeterministic” function of the Clones contract calculates the proxy contract address. The calculated proxy contract address depends on the input parameter `salt` and the implementation contract address, but is independent of the implementation contract’s bytecode. Therefore, we only need to deploy one contract on address A; the specific content of the contract does not affect the calculation of the proxy contract address. We can then directly deploy a contract with ETH extraction functionality on address A, as shown in the code below.
On the testnet, implementation contract A is deployed by the project owner’s address (EOA). Therefore, the address of implementation contract A is only related to the transaction initiator and its nonce. Thus, by observing the transactions that deploy implementation contract A on the testnet, finding the relevant nonce, pushing the project owner’s address (EOA) on the mainnet to the specified nonce, and then deploying implementation contract A, you can proceed.
3. Deploy a proxy contract on the mainnet at the same address C as the testnet. Observe the transactions of the proxy contract C deployed on the testnet, obtain the salt information, and call the “deployProxyByImplementation” function of the factory contract B, passing the address of the implementation contract A and the salt as parameters. This will deploy the proxy contract at address C on the mainnet.
4. The mainnet proxy contract C is invoked to withdraw funds. The project address (EOA) calls the withdraw function of proxy contract C, specifies the recipient of funds, successfully withdraws the frozen ETH from proxy contract C, and then returns it to the relevant user.
2.4. SummaryAs can be seen from the above rescue plan, the funds can only be recovered if many conditions are met simultaneously, such as the contract deployer’s relevant nonce on the target chain not being used, the contract trapping the funds having a withdrawal function or being able to deploy a withdrawal function in various ways (the contract can be upgraded or a proxy such as Clones can be used, etc.).
Therefore, everyone must be extremely careful when trading, meticulously verifying each transaction before interacting with the contract. Before engaging with the contract, you can use ZAN’s AI SCAN vulnerability scanning tool to check its security. If your funds are accidentally locked, don’t panic; you can contact ZAN’s contract security audit team to try and help you recover your funds.
This article was written by Cara ( @Cara6289 ) ZAN Team (X 账户 @zan_team ) & AntChain OpenLabs (X account @AntChainOpenLab ).
本文来源于互联网: Web3 Security Series: Can funds mistakenly transferred to other blockchains be recovered?Recommended Articles #分析# 以太坊# 代币# 工具# web3© 版权声明文章版权归作者所有,未经允许请勿转载。 上一篇 Has Bitcoin's four-year cycle failed? 下一篇 Weekly Editor's Picks (November 15-21) 相关文章 Having faith: 15 reflections on Bitcoin and the crypto market 6086cf14eb90bc67ca4fc62b 37,921 1 This weeks Meme bottom-fishing list: FREDs top holdings increased, ai16z released good news 6086cf14eb90bc67ca4fc62b 37,679 2 Chapter 2 of Story: AI-native infrastructure empowers the $70 trillion IP economy 6086cf14eb90bc67ca4fc62b 26,705 6 A complete review of 15 funded projects in the Monad ecosystemRecommended Articles 6086cf14eb90bc67ca4fc62b 28,809 5 In-depth research report on the privacy coin sector: From the demand for anonymity to the revaluation of value in the er 6086cf14eb90bc67ca4fc62b 16,403 Master the Secrets of Ethereum Passive Income Strategy by 2025 6086cf14eb90bc67ca4fc62b 40,210 2 无评论 您必须登录后才能发表评论! 立即登录 没有评论... Bee.com 全球最大的 Web3 门户网站 合作伙伴 硬币卡 Binance CoinMarketCap CoinGecko Coinlive 装甲 下载蜜蜂网络APP,开始web3之旅 白皮书 角色 常见问题 © 2021-2026.保留所有权利。. 隐私政策 | 服务条款 下载蜜蜂网络 APP 并开始 web3 之旅 全球最大的 Web3 门户网站 合作伙伴 CoinCarp Binance CoinMarketCap CoinGecko Coinlive Armors 白皮书 角色 常见问题 © 2021-2026.保留所有权利。. 隐私政策 | 服务条款 搜索 搜索InSite链上社会新闻 热门推荐: 空投猎人 数据分析 加密货币名人 陷阱探测器 简体中文 English 繁體中文 日本語 Tiếng Việt العربية 한국어 Bahasa Indonesia हिन्दी اردو Русский 简体中文智能索引记录
-
2026-03-02 10:29:35
综合导航
成功
标题:戴字个解释和含义有哪些?_一世迷命理网
简介:戴字,是指根据个人的出生年份、月份、日份和时辰,在接受命理分析后,给予自己取一个寓意吉祥的字或字词作为自己的名字。这个名
-
2026-03-02 10:44:37
教育培训
成功
标题:华山作文300字(精)
简介:在日常生活或是工作学习中,大家都尝试过写作文吧,借助作文人们可以实现文化交流的目的。你知道作文怎样才能写的好吗?下面是小
-
2026-03-02 17:17:18
综合导航
成功
标题:ç
åçæ¼é³_ç
åçææ_ç
åçç¹ä½_è¯ç»ç½
简介:è¯ç»ç½ç åé¢é,ä»ç»ç å,ç åçæ¼é³,ç 忝
-
2026-03-02 17:49:44
游戏娱乐
成功
标题:火箭大逃亡无敌版,火箭大逃亡无敌版小游戏,4399小游戏 www.4399.com
简介:火箭大逃亡无敌版在线玩,火箭大逃亡无敌版下载, 火箭大逃亡无敌版攻略秘籍.更多火箭大逃亡无敌版游戏尽在4399小游戏,好
-
2026-03-02 12:48:53
视频影音
成功
标题:《Братья Разбойники》1911电影在线观看完整版剧情 - xb1
简介:Братья Разбойники(1911)电影免费在线观看完整版剧情介绍,Братья Разбойники主要演员
-
2026-03-02 12:05:59
综合导航
成功
标题:成长的烦恼小学作文15篇
简介:在平平淡淡的学习、工作、生活中,大家都不可避免地会接触到作文吧,作文是一种言语活动,具有高度的综合性和创造性。那么你有了
-
2026-03-02 10:45:27
综合导航
成功
标题:机器人二年级作文10篇
简介:在我们平凡的日常里,大家总免不了要接触或使用作文吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题意义的记叙方
-
2026-03-02 15:35:45
数码科技
成功
标题:免费生辰八字测名字打分样板-免费起名_免费取名_宝宝起名_起名软件_名字测试打分解名(缇帕电子科技)-起点起名网
简介:在线生辰八字姓名测试打分是易名轩起名网精心开发的在线起名字测试打分系统,您只需输入姓名,必须为“中文”,出生日期为阳历,
-
2026-03-02 13:57:48
综合导航
成功
标题:盗墓开局签到一枚长生丹药最新章节列表最新章节_盗墓开局签到一枚长生丹药最新章节列表全文免费阅读-笔趣阁
简介:盗墓开局签到一枚长生丹药最新章节列表盗墓开局签到一枚长生丹药最新章节列表全文免费阅读盗墓开局签到一枚长生丹药最新章节列表
-
2026-03-02 15:34:45
教育培训
成功
标题:华鸠技术论坛 - 广泛使用的编程交流技术平台
简介:华鸠技术论坛-学习编程技术,探讨软硬件编程。让你的问题快速被解决,让专业的人做专业的事。海量资源下载。
-
2026-03-02 11:51:52
综合导航
成功
标题:AI智能索引 - AI智能索引
简介:AI智能索引 - 提供全网公开链接智能索引服务,快速访问目标内容,支持分类筛选和智能导航
-
2026-03-02 18:04:20
电商商城
成功
标题:【京东优评】热卖商品_优质评价排行、看实拍买好货 - 京东
简介:京东优评频道,为用户提供真实、专业的商品评价排行榜,包含商品价格、图片、品牌、优惠券、商品怎么样等多维度信息,精选用户购
-
2026-03-02 17:52:33
综合导航
成功
标题:How the magic is done - The tilted house
简介:1x.com is the world
-
2026-03-02 12:44:17
综合导航
成功
标题:환경 - Apple (KR)
简介:Apple 2030은 재활용 소재, 재생 가능 전력, 저탄소 운송 방식을 통해 자사 전체 탄소 발자국을 넷
-
2026-03-02 10:42:41
教育培训
成功
标题:我的家风_550字_作文网
简介:很多家中都有家训家风,要说起我们家的家训家风,那就是:要有孝心,勤俭节约了。 爸爸妈妈从小就教育我要有孝心,要尊老爱幼。
-
2026-03-02 10:56:34
综合导航
成功
标题:åè¡çæ¼é³_åè¡çææ_åè¡çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½åè¡é¢é,ä»ç»åè¡,åè¡çæ¼é³,åè¡æ¯
-
2026-03-02 10:29:01
综合导航
成功
标题:Fantasy Football 2025: QB Cameron Ward player profile
简介:Nathan Jahnke reveals quarterback Cameron Ward
-
2026-03-02 13:33:05
综合导航
成功
标题:Box Challenge - Free Online Mobile Game on 4J.com
简介:Box Challenge is a free online Mobile game on 4j.Com. You ca
-
2026-03-02 18:11:38
电商商城
成功
标题:酷开电视75排行 - 京东
简介:京东是国内专业的酷开电视75网上购物商城,本频道提供酷开电视75商品热卖品牌排行榜信息,为您选购酷开电视75提供品牌排行
-
2026-03-02 16:42:24
新闻资讯
成功
标题:为什么你的数据科学项目终将失败?, 站长资讯平台
简介:作者:Daniel Amner 译者:Sambodhi 来源:InfoQ 虽然数据是是推动真正数字转换的关键要素,但组织
-
2026-03-02 11:59:02
综合导航
成功
标题:仁王3追寻武者之影任务怎么做-追寻武者之影支线任务做法介绍_3DM单机
简介:《仁王3》中的支线任务的数量是非常多的,而且很多任务的重要性非常大,关系到下一个区域的重要道具,追寻武者之影就是比较重要
-
2026-03-02 13:04:17
视频影音
成功
标题:第229章_模拟恋爱游戏视频-笔趣阁
简介:模拟恋爱游戏视频最新章节第229章全文免费阅读笔趣阁精选模拟恋爱游戏视频无错最新章节。
-
2026-03-02 17:53:38
数码科技
成功
标题:网站在线留言系统福州模板做网站-北京孤凡电子商务有限公司
简介:网站在线留言系统,福州模板做网站,做网站开发需要学什么软件,关于网站建设的报告题目介绍 给定一个非负整数 numRows
-
2026-03-02 16:31:26
游戏娱乐
成功
标题:辛普森卡丁车赛,辛普森卡丁车赛小游戏,4399小游戏 www.4399.com
简介:辛普森卡丁车赛在线玩,辛普森卡丁车赛下载, 辛普森卡丁车赛攻略秘籍.更多辛普森卡丁车赛游戏尽在4399小游戏,好玩记得告
-
2026-03-02 17:19:24
综合导航
成功
标题:京东(JD.COM)-正品低价、品质保障、配送及时、轻松购物!
简介:京东JD.COM-专业的综合网上购物商城,为您提供正品低价的购物选择、优质便捷的服务体验。商品来自全球数十万品牌商家,囊
-
2026-03-02 17:01:03
游戏娱乐
成功
标题:无敌流日常最新章节_无敌流日常小说免费全文阅读_恋上你看书网
简介:关于无敌的随性日常:七夕节,本是爱意弥漫的日子,却成了高粱命运的转折点。刚从牢中取保中脱身,他便意外穿越到自己亲手打造的
-
2026-03-02 12:14:57
游戏娱乐
成功
标题:刺客信条英灵殿攻略_全支线任务全收集攻略_图文全攻略_3DM单机
简介:《刺客信条:英灵殿》图文全攻略,全支线任务全收集攻略(含“通关剧情流程”“全支线任务/全结局”“全收集攻略”)。《刺客信
-
2026-03-02 13:28:18
综合导航
成功
标题:团结的小学作文300字六篇
简介:在我们平凡的日常里,大家都写过作文吧,写作文是培养人们的观察力、联想力、想象力、思考力和记忆力的重要手段。相信许多人会觉
-
2026-03-02 11:27:06
综合导航
成功
标题:襄阳市子熹书房图书有限公司招聘-597直聘
简介:597直聘为您提供招聘信息、公司简介、公司地址、公司福利等详细信息,让您在选择前有一个全面的了解.公司介绍:
-
2026-03-02 15:45:31
综合导航
成功
标题:周易 第48页 - 吉吉算命网
简介:周易 第48页_吉吉算命网