Important
Recovery is only possible if the target nonce hasn't been used on the destination chain yet.
This repository helps recover funds mistakenly sent to token contract addresses on wrong blockchains. While such funds may appear permanently lost, they can be recovered due to how the Ethereum Virtual Machine (EVM) derives contract addresses through the CREATE
opcode. This repository also lists projects capable of recovering funds if the nonce remains unused on the affected chains and the original deployer's private key is still available.
When a contract is deployed, its address is deterministically generated from:
- The deployer's address
- The deployment nonce
Technically, it's
address computedAddress = keccak256(rlpEncode([deployerAddress, deployerNonce]))[12:]
.
This means funds sent to a contract address on chain A
can be recovered on chain B
by deploying a recovery contract at the same nonce.
- Target chain: Token deployed on Ethereum at nonce 46.
- Problem: User sends 82 ETH to same address on Arbitrum.
- Solution: Deploy recovery contract on Arbitrum using nonce 46.
- Result: Funds become accessible through the recovery contract.
Note
Currently, funds stuck on ZKsync cannot be recovered due to differences in contract address derivation.
- Foundry
- Git
- Private key with enough native tokens for deployment (optional)
# Clone repository
git clone https://github.com/pcaversaccio/Cross-Chain-Token-Recovery-Registry.git
cd Cross-Chain-Token-Recovery-Registry
# Install dependencies
forge install
The following networks are supported via configuration in foundry.toml
:
[rpc_endpoints]
arb = "https://arbitrum.drpc.org"
avax = "https://avalanche.drpc.org"
base = "https://mainnet.base.org"
bsc = "https://bsc-dataseed1.defibit.io"
gnosis = "https://rpc.gnosischain.com"
eth = "https://rpc.mevblocker.io"
op = "https://op-pokt.nodies.app"
polygon = "https://rpc.ankr.com/polygon"
Update settings in ./script/constants.sol
:
string constant ORIGINAL_CHAIN = "bsc"; // Chain where contract was originally deployed.
string constant TARGETED_CHAIN = "eth"; // Chain where funds are stuck.
uint256 constant TARGETED_NONCE = 4; // Original deployment nonce.
address constant TARGETED_CONTRACT = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;
address constant broadcaster = 0xF07C30E4CD6cFff525791B4b601bD345bded7f47; // Deployer address.
- Update token list in
./script/Deploy.s.sol
:
address[] updatedTokens = [
// ...
];
- Run recovery script:
Caution
Only append --broadcast --private-key YOUR_PRIVATE_KEY
to the command when executing the recovery!
# Dry run (simulation)
forge script DeployRecovery --via-ir
# Actual recovery (requires private key)
forge script DeployRecovery --via-ir --broadcast --private-key YOUR_PRIVATE_KEY
Example output:
> Deployed Recovery: 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56
> Recovered Native: 16.609236676877602183 ETH
> Recovered ERC20 tokens:
> 4078088.277373556602614074 BUSD
> 21632.957664 USD Coin
> 13201.946536 Tether USD
> 20094.329000000000000000 DAO Maker
> 1106.791111111110000000 Immutable X
- You may explore
DeployRecovery
,NativeRecovery
,ERC721Recovery
,ERC1155Recovery
, andERC20Recovery
according to your needs.
Date: 1 November 2024.
Entity | Amount (k$) |
---|---|
Binance | 6748.4 |
Tether | 842 |
Avalanche | 740.6 |
Polygon | 438.5 |
Base | 380.1 |
MakerDAO | 330.6 |
Immutable X | 303 |
Circle | 292.4 |
Yuga Labs | 244 |
Shiba Inu | 142 |
Radiant | 132 |
Orion Protocol | 150 |
Blast | 111 |
Blur | 102.5 |
Arbitrum | 101.7 |
Quant | 91.7 |
Reputation | 92.2 |
Fantom | 87 |
Synapse | 77 |
SSV | 66.7 |
Coinbase | 52 |
Bella Protocol | 48.1 |
Optimism | 40 |
Wonderland | 34.4 |
Jasmy | 36.2 |
Gitcoin | 33.4 |
Sandbox | 30.7 |
Wormhole | 29.2 |
DYDX | 25.2 |
Terra | 24.8 |
BakerySwap | 23 |
Wrapped BTC | 23.7 |
Avalaunch | 23.3 |
Bitrise | 22.1 |
EverGrow | 20 |
10SET | 20 |
EtherFi | 20.3 |
KyberSwap | 20.6 |
ThorChain | 17.7 |
LiFi | 13.4 |
Joe Trader | 11.3 |
Scroll | 11.8 |
Injective Protocol | 11.7 |
Paxos | 12.5 |
MEXC | 13 |
Cerol | 13 |
Degen | 7.9 |
Frax Finance | 9.9 |
Lido | 8.1 |
ENS | 8.7 |
ConstitutionDAO | 6.6 |
OpenSea | 6.7 |
Chainlink | 6.7 |
Total | 12159.4 |