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?
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.