0

Having an Ethereum address, I need to check whether it is a wallet or a token (ERC-20 contract).

How to check? (I need to implement it with Web3js.)

Ideally, it should also reject contracts which are not ERC-20.

1
1

Similar question to How to detect if an address is a contract?

you can refer to getcode

if the address is representing an External Owned Account you will get 0x as response otherwise you will get the contract's bytecodeode. for example :

var code = web3.eth.getCode("0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8");
console.log(code); // "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"

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.