Files
proxmox/docs/archive/historical/ETHERSCAN_BYTECODE_MISMATCH_ANALYSIS.md
defiQUG cb47cce074 Complete markdown files cleanup and organization
- Organized 252 files across project
- Root directory: 187 → 2 files (98.9% reduction)
- Moved configuration guides to docs/04-configuration/
- Moved troubleshooting guides to docs/09-troubleshooting/
- Moved quick start guides to docs/01-getting-started/
- Moved reports to reports/ directory
- Archived temporary files
- Generated comprehensive reports and documentation
- Created maintenance scripts and guides

All files organized according to established standards.
2026-01-06 01:46:25 -08:00

4.7 KiB

Etherscan Bytecode Mismatch - Deep Analysis

Error: "Unable to find matching Contract Bytecode and ABI"
Contract: 0x89dd12025bfCD38A168455A44B400e913ED33BE2


🔍 Bytecode Analysis

What Etherscan Expects (Deployed Bytecode)

60806040526005600155670e92596fd62900006002556710a741a462780000600355...

What Our Source Code Compiles To

60c034620001cb57601f62001b6638819003918201601f191683019291906001600160401b038411...

These are completely different bytecodes!


⚠️ Root Cause Analysis

The bytecode mismatch indicates one of these scenarios:

1. Source Code Mismatch

The deployed contract was compiled from different source code than what we have.

Possible reasons:

  • Contract was modified before deployment
  • Different version of the contract was deployed
  • Source code has changed since deployment

2. Compiler Settings Mismatch

Even with viaIR: true, the bytecode doesn't match, suggesting:

  • Different optimizer settings
  • Different Solidity version
  • Different EVM version
  • Different compilation method

3. Wrong Contract Address

The address 0x89dd12025bfCD38A168455A44B400e913ED33BE2 might be:

  • A different contract entirely
  • A proxy contract
  • A modified version

Solutions to Try

Solution 1: Try Single File WITHOUT Via IR

Settings:

  • Compiler Type: SINGLE FILE / CONCATENATED METHOD
  • Compiler Version: v0.8.20+commit.a1b79de6
  • License: MIT License (MIT)
  • Optimization: Yes (200 runs)
  • Via IR: No (or leave default)

Contract Code: Copy from docs/CCIPWETH9Bridge_flattened.sol

Constructor Arguments:

0x00000000000000000000000080226fc0ee2b096224eeac085bb9a8cba1146f7d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca

Why: Even though deployment used --via-ir, the bytecode mismatch suggests trying without it.


Solution 2: Check for Different Source Code Version

The contract may have been deployed from a modified version. Check:

  • Git history for changes to CCIPWETH9Bridge.sol
  • Different branches or commits
  • Manual modifications before deployment

Solution 3: Verify Contract Address

Confirm the contract address is correct:

  • Check deployment transaction
  • Verify it's the right network (Ethereum Mainnet)
  • Ensure it's not a proxy or different contract

Solution 4: Try Different Compiler Versions

Try these compiler versions in order:

  1. v0.8.20+commit.a1b79de6 (current)
  2. v0.8.19+commit.7dd6d404 (matches pragma)
  3. v0.8.20 (without commit hash)

Solution 5: Check Deployment Transaction

Get the exact deployment transaction to see:

  • What source code was used
  • What compiler settings were used
  • If there were any modifications
# Get deployment transaction
cast tx <DEPLOYMENT_TX_HASH> --rpc-url $ETHEREUM_MAINNET_RPC

🔍 Etherscan Output Analysis

From the error message:

Found Contracts:

  • CCIPWETH9Bridge.sol:CCIPWETH9Bridge
  • CCIPWETH9Bridge.sol:IERC20
  • CCIPWETH9Bridge.sol:IRouterClient

Compiler Settings Used:

  • Compiler Version: v0.8.20+commit.a1b79de6
  • Optimization Enabled: True
  • Runs: 200

Issue: Bytecode doesn't match despite correct settings.


Step 1: Try Single File Method (No Via IR)

  1. Go to Etherscan verification page
  2. Select "SINGLE FILE / CONCATENATED METHOD"
  3. Compiler: v0.8.20+commit.a1b79de6
  4. License: MIT License (MIT)
  5. Optimization: Yes (200 runs)
  6. Via IR: No (or default)
  7. Paste flattened contract code
  8. Enter constructor arguments
  9. Submit

Step 2: If That Fails

Try different compiler versions:

  • v0.8.19+commit.7dd6d404
  • v0.8.20 (no commit)

Step 3: If Still Fails

  • Check deployment transaction for exact source code
  • Verify contract address is correct
  • Consider the contract may have been deployed from modified source

🔧 Alternative: Manual Bytecode Comparison

Compare the deployed bytecode with compiled bytecode:

# Get deployed bytecode
cast code 0x89dd12025bfCD38A168455A44B400e913ED33BE2 --rpc-url $ETHEREUM_MAINNET_RPC > deployed.bytecode

# Compile locally
forge build --via-ir
# Compare with out/ccip/CCIPWETH9Bridge.sol/CCIPWETH9Bridge.json

⚠️ Important Notes

  1. The bytecode mismatch is significant - not just a minor difference
  2. This suggests source code or settings don't match deployment
  3. Try without via-ir first - even though deployment used it
  4. Check if contract was modified before deployment

Last Updated: $(date)
Status: ⚠️ BYTECODE MISMATCH - TRY WITHOUT VIA IR