1

I know that in Ethereum, same addresses works across the network(mainnet and all testnets).

But I am looking to know if there are any chances to find out the network on which a contract is deployed by using its contract address because only relevant network will be having the data of contract stored.

Also how much reliable this approach can be?

2

May be this is not the best solution but can be helpful for now:

set web3 provider for every testnet one by one and then try to get the size of the contract using following web3 call.

web3.eth.getCode(address [, defaultBlock] [, callback])

this returns the data if the address is a contract.

you may get the data from multiple chains. In this case you'll end up with multiple networks having code for same address.

  • 1
    seems reasonable – Aniket Mar 28 at 13:28
1

You may try to find this address in https://etherscan.io/ on different networks and see where it has some code or non-zero ether balance:

Etherscan also has an API for this that you can use to automate such lookups.

  • makes sense.... – Aniket Mar 28 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.