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 ATokens, 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 ) dari Tim ZAN (akun X @zan_team ) & AntChain OpenLabs (X account @AntChainOpenLab ).
Artikel ini bersumber dari internet: Web3 Security Series: Can funds mistakenly transferred to other blockchains be recovered?Recommended Articles Analisis ## ethereum# TandaAlat ## web3© 版权声明Array 上一篇 Has Bitcoin's four-year cycle failed? 下一篇 Weekly Editor's Picks (November 15-21) 相关文章 Quick Look at Virtuals’ New Launch Mechanisms: Pegasus, Unicorn, and Titan 6086cf14eb90bc67ca4fc62b 13,438 1 24H Hot Cryptocurrencies and Key News|Prince Group Founder Chen Zhi Deported to China; Polymarket Rules US Military Venezuela Operation Does Not Constitute “Invasion” (January 8) 6086cf14eb90bc67ca4fc62b 11,160 2 Exploring Arc Miner: An Innovative Passive Income Cloud Mining Solution admin 20,991 1 Since LTC was positioned as a Meme coin, it has soared. What can ordinary people do in the Meme super cycle? 6086cf14eb90bc67ca4fc62b 43,246 3 PanasMalam pemilu semakin dekat, bagaimana hasil pemilu akan memengaruhi pasar kripto? 6086cf14eb90bc67ca4fc62b 39,045 4 The new landscape of public chains driven by stablecoins and RWA 6086cf14eb90bc67ca4fc62b 24,997 1 Tidak ada komentar Anda harus login untuk meninggalkan komentar! Segera masuk Tidak ada komentar... artikel Terbaru Did Jane Street “Manipulate” BTC? Decoding the AP System, Understanding the Power Struggle Behind ETF Creation and Redemption Pricing 15 jam yang lalu 539 Stop Comparing Bitcoin to Gold—It’s Now a High-Volatility Software Stock 15 jam yang lalu 630 Matrixport Research: $25 Billion Gamma Unwinding Imminent, Liquidity Yet to Return Behind the Rebound 15 jam yang lalu 594 ERC-5564: Ethereum’s Stealth Era Has Arrived, Receiving Addresses No Longer ‘Exposed’ 15 jam yang lalu 517 Hong Kong Regulatory Green Light: Asseto Enables DL Holdings to Achieve Compliance for Two RWA Business Implementations 15 jam yang lalu 561 Situs Web PopulerTempoLighterGAIBGliderPlanckRaylsBCPokerVooi Bee.com Portal Web3 terbesar di dunia Mitra KoinCarp binance KoinMarketCap KoinGecko hidup koin Armor Unduh Aplikasi Bee Network dan mulai perjalanan web3 Kertas putih Peran Pertanyaan Umum © 2021-2026. Semua Hak Cipta Dilindungi Undang-Undang. Kebijakan pribadi | Ketentuan Layanan Unduh Aplikasi Jaringan Lebah dan memulai perjalanan web3 Portal Web3 terbesar di dunia Mitra CoinCarp Binance CoinMarketCap CoinGecko Coinlive Armors Kertas putih Peran Pertanyaan Umum © 2021-2026. Semua Hak Cipta Dilindungi Undang-Undang. Kebijakan pribadi | Ketentuan Layanan Mencari MencariDi dalam SitusDi RantaiSosialBerita 热门推荐: Pemburu Airdrop Analisis data Selebriti Kripto Detektor Perangkap Bahasa Indonesia English 繁體中文 简体中文 日本語 Tiếng Việt العربية 한국어 हिन्दी اردو Русский Bahasa Indonesia智能索引记录
-
2026-03-02 16:26:43
综合导航
成功
标题:Protection de prêt hypothécaire TD
简介:Gagnez en confiance sur le plan financier! La Protection de
-
2026-03-02 12:30:08
教育培训
成功
标题:一堂的课作文500字必备(3篇)
简介:无论在学习、工作或是生活中,大家或多或少都会接触过作文吧,作文可分为小学作文、中学作文、大学作文(论文)。相信许多人会觉
-
2026-03-02 12:45:07
教育培训
成功
标题:春节的的作文600字4篇【精华】
简介:在日常生活或是工作学习中,大家都经常接触到作文吧,作文根据写作时限的不同可以分为限时作文和非限时作文。一篇什么样的作文才
-
2026-03-02 12:15:41
综合导航
成功
标题:感恩:怀念父母的那些微瞬间-励志一生
简介:感恩:怀念父母的那些微瞬间_感恩:怀念父母的那些微瞬间 这个世界上,有一种爱,亘古绵长,无私无求;不因季节更替。不因名
-
2026-03-02 11:01:03
综合导航
成功
标题:NVE Corp - Digital Input Isolated Transceivers (IL4xx / IL29xx / IL30xx ...
简介:This is Digital Input Isolated Transceivers (IL4xx / IL29xx
-
2026-03-02 12:35:35
教育培训
成功
标题:写作指导_作文网
简介:作文网写作指导频道提供大量精选写作指导类文章,包含写作方法、文学常识、写作基础、经验交流等相关写作的精选文章,是学生学习
-
2026-03-02 10:54:22
综合导航
成功
标题:variable BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1 Node.js zlib module Bun
简介:API documentation for variable node:zlib.constants.BROTLI_DE
-
2026-03-02 14:35:04
视频影音
成功
标题:重庆骂人顺口溜-励志一生
简介:重庆骂人顺口溜_ 重庆骂人顺口溜 1、脸皮厚,有口臭,走路向左不向右,长期骗你外婆,和别个视频脱衣秀,我两锭子把你打
-
2026-03-02 14:05:50
综合导航
成功
标题:以礼物为话题的作文400字(精选4篇)
简介:相信大家都不可避免地要接触到作文吧,尤其是在作文中有重要意义的话题作文,话题作文具有自由性的特点,考生在题目、选材、文体
-
2026-03-02 06:27:17
综合导航
成功
标题:母亲的盲道-励志一生
简介:母亲的盲道_母亲的盲道 那一年,他29岁,研究生毕业,跳槽到一家外企,成为公司最年轻的业务经理。不料,事业风声水起之际
-
2026-03-02 06:32:42
图片素材
成功
标题:宝鸡的作文200字 描写宝鸡的作文 关于宝鸡的作文-作文网
简介:作文网精选关于宝鸡的200字作文,包含宝鸡的作文素材,关于宝鸡的作文题目,以宝鸡为话题的200字作文大全,作文网原创名师
-
2026-03-02 15:27:30
实用工具
成功
标题:2023黑龙江一建成绩查询时间-一级建造师-233网校
简介:2023黑龙江一建成绩查询时间:12月5日。一建考试是全国统考,因此全国一建考试成绩公布时间是统一的,一级建造师考试成绩
-
2026-03-02 09:45:59
综合导航
成功
标题:Connect The Pipes: Connecting Tubes - Play The Free Mobile Game Online
简介:Connect The Pipes: Connecting Tubes - click to play online.
-
2026-03-02 12:40:07
综合导航
成功
标题:Loetanks - Play The Free Game Online
简介:Loetanks - click to play online. Loetanks is a top-down turn
-
2026-03-02 10:57:45
综合导航
成功
标题:1125 - StrongShop
简介:Item Name : 1125 Description : 2.5
-
2026-03-02 14:27:50
综合导航
成功
标题:FS.com Australia - Data Center , Enterprise & ISP Technology Solution
简介:Providing scalable network technology solutions for Data Cen
-
2026-03-02 14:11:34
综合导航
成功
标题:兴趣作文600字
简介:在日常学习、工作抑或是生活中,大家最不陌生的就是作文了吧,作文是一种言语活动,具有高度的综合性和创造性。那么你知道一篇好
-
2026-03-02 14:37:56
综合导航
成功
标题:Surans. World English Historical Dictionary
简介:Surans. World English Historical Dictionary
-
2026-03-02 14:58:46
综合导航
成功
标题:Google Play용 시뮬레이션 게임
简介:Google Play용 시뮬레이션 게임
-
2026-03-02 14:03:26
综合导航
成功
标题:Rutter’s Debuts Fall-Themed Beverages
简介:Pumpkin-flavored coffee, milkshakes, milk available for a li
-
2026-03-02 12:46:39
教育培训
成功
标题:二年级作文3篇【荐】
简介:在日常学习、工作或生活中,大家或多或少都会接触过作文吧,作文可分为小学作文、中学作文、大学作文(论文)。相信写作文是一个
-
2026-03-02 15:07:31
教育培训
成功
标题:【必备】四年级童话作文
简介:在平凡的学习、工作、生活中,许多人都写过作文吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己能明白的语言
-
2026-03-02 15:10:44
图片素材
成功
标题:分享的作文550字 描写分享的作文 关于分享的作文-作文网
简介:作文网精选关于分享的550字作文,包含分享的作文素材,关于分享的作文题目,以分享为话题的550字作文大全,作文网原创名师
-
2026-03-02 14:29:34
数码科技
成功
标题:美漫丧钟第1334章?拉壮丁_美漫丧钟_混沌文工团_十二小说网_规则类怪谈扮演指南
简介:美漫丧钟最新章节第1334章?拉壮丁出自混沌文工团的作品美漫丧钟最新章节每天第一时间更新。美漫丧钟txt电子书下载,最新
-
2026-03-02 15:28:27
游戏娱乐
成功
标题:大国战武将那个组合好 怎么选择武将_欢乐园游戏
简介:大国战是写实战场的策略游戏,逼真还原了三国真实且热血的战斗。不过大国战武将那个组合好?怎么选择武将?实际上对于大国战的武
-
2026-03-02 12:54:57
教育培训
成功
标题:可爱的小猫作文四年级
简介:在生活、工作和学习中,大家都写过作文,肯定对各类作文都很熟悉吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题
-
2026-03-02 13:18:03
综合导航
成功
标题:KYK 김영귀환원수 알칼리이온수기 전문 브랜드
简介:47년 전통 대통령 훈장수훈 식약처 허가 알칼리이온수기로 4대 위장질환 개선 도움 가족 건강 지키는 알칼리
-
2026-03-02 15:52:58
教育培训
成功
标题:秀外惠中的意思解释_秀外惠中是什么意思-雄安文学网
简介:秀外惠中是什么意思?雄安文学网为您提供秀外惠中的意思解释、拼音、近反义词,以及秀外惠中成语接龙,供成语爱好者参考学习用。
-
2026-03-02 15:49:49
教育培训
成功
标题:亲情的作文
简介:在学习、工作、生活中,大家都接触过作文吧,写作文可以锻炼我们的独处习惯,让自己的心静下来,思考自己未来的方向。写起作文来
-
2026-03-02 06:34:33
综合导航
成功
标题:Sapphire Info Solutions (P) Ltd Products & Services - PR.com
简介:View products and services from Sapphire Info Solutions (P)