I know that an Ethereum transaction addressed to '0x000..000' is creating a new contract. Now, given a transaction address to non-zero address, I want to identify whether it is a transaction to an externally owned account(non-contract address) or to a smart contract.

One approach I figured out is to look at the debug trace of the transaction and distinguish between them.

My question is:

Is there an alternative way of identifying whether the recipient of a transaction is an externally owned account or a smart contract?

Any solution using geth console or web3 API would be appreciated. Thanks


1 Answer 1


This is the common Qus most of dev are raising qus, For better understanding I am discussing little more info Ethereum there are two types of accounts:

  • Externally owned account (EOA), has private key user holds.

  • Contract account: Private key will not be available, so that's reason even contract account owner also can't have a control on contract code.

As per white paper both address has same structure, but EOA has code is 0x0 where is case of contract its has binary abi.

Sound's good, how will I get the contract abi code.

For Geth:

eth.getCode('<ADDRESS>') will return 0x0 for EOA, for contracts you will have 0xabc1231213213123837198723...... hex.



Not the answer you're looking for? Browse other questions tagged or ask your own question.