for a tx or a contract or a wallet?
Tx you can do by number of bytes. There’s a function in openzeppelin’s address library (isContract) to determine which of the other two it is - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol
in javascript sorry
EOA and contract accounts have a different code size then you can use It to determinand if an address is a EOA or contract account but you will need use the assembly inline: function isContract(address addr) returns (bool) { uint size; assembly { size := extcodesize(addr) } return size > 0; }
in javascript?
https://web3js.readthedocs.io/en/v1.2.0/web3-utils.html?highlight=isValidAddress#isaddress It seems with what do you want
https://ethereum.stackexchange.com/questions/28521/how-to-detect-if-an-address-is-a-contract/28527
Обсуждают сегодня