I have list of addresses & I am trying to find out if the address is wallet address or smart contract address. I am using web3js. Is there any way to distinguish between smart contract and wallet address?

As an example, let's say I have an address x = "0x0f3dd2fcd9ff5b8b082db6e39a1b11a579cfdee5" and I need to know if x is a smart contract or wallet.

thank you very much.


1 Answer 1


A smart contract address is an ethereum address that has code/data behind it. so to check if the given address is "currently" a contract you can use the getCode method from Web3js

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

If this method returns something then it is 100% a contract, otherwise it is an address of a wallet or a contract that has not been deployed yet (or already self destructed)


  • 1
    GetCode returns empty for self-destructed contracts.
    – Ismael
    Commented Nov 6, 2021 at 5:11
  • Thank you very much @Ismael. This is what I was looking for. Commented Nov 6, 2021 at 10:10

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.