How to determine if an address is EOA or contract without pulling the entire code?

Cryptocurrency News and Public Mining Pools

How to determine if an address is EOA or contract without pulling the entire code?

The common way to determine if an address is EOA or contract is to call `getCode` and check if the result is `0x` or `0x0`.

For example, this is MetaMask code doing this:

https://github.com/MetaMask/metamask-extension/blob/e3ea4f2cd044d48c61b6a35ef206fa942f3b43d1/shared/modules/contract-utils.js

But it introduces some network delay, especially if the target contract is huge(for example, OpenSea contract), which may result in several seconds delay in a bad network situation.

Is there a way to optimize this?

submitted by /u/wonderfuly
[link] [comments]