1

I've been trying to get a smart contract name given the contract address. Not a smart contract in particular, but I wanted the process to be able to get the name of any contract by the address. I've been using web3js and infura but without any luck. Can anyone point me towards the right method to use?

1
  • You cannot do this via web3.js. You can do it via Etherscan, but only if the deployer of the contract (or anyone who knows its source code for that matter) has verified it on Etherscan. Commented Dec 24, 2020 at 15:42

1 Answer 1

2

You have a couple of options. None of them great.

You can use ENS. This is one of its primary purposes. Check the ENS docs.

You can use Etherscan. Again nowhere near perfect, but a possible source of some names.

The trouble, as you’ve encountered, is that there is no centralized registry (nor should there be — nor can there be!).

Both of the above sources are hit or miss at best. People have to have gone to these sites and added the names. It’s mostly miss except for popular contracts.

1
  • Thanks Thomas, I actually tried with Etherscan but this feature is behind their paid API and it's quite expensive for using only one feature. I will definitely check out the ENS doc you mentioned and see if I can find anything useful. Commented Dec 24, 2020 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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