EatTheBlocks Forum

How to check if ethereum address is valid in solidity

Is there a way to check if the ethereum address is valid in solidity ? I think I might have found a way in web3js library on utils, but want to know if this method is possible on solidity.

And how can I use solidity to know the difference between account addresses and smart contract address ?

Your help will be highly appreciated (still new guys)… Thanks in advance.

It’s not possible to pass an address less or more than 160bits in Solidity. For verifying checksum addresses, I dont know how to verify this in Solidity.

For determining if an address is a smart contract, you can use some assembly and the extcodesize opcode. if code size is 0, its not a smart contract, otherwise it is.