0

If so, why is it that in externally owned accounts there is no storage and code hash (Smart contract codes) which are only available in contract accounts?

1 Answer 1

0

EOA are little different from the contract accounts. EOA are able to sign transactions and owned by private key. While the contract accounts inherintely aren't capable of self-execution.

To your question, sending ether(or any network currency) from one EOA to another EOA doesn't require any code.

For example, if you want to send 1 ETH to your friend, you can directly go to wallets such as metamask and send ETH by signing contracts.

However, EOA aren't capable of storing contracts that is why EOA's code hash is empty string.

And CA's quite opposite. They are capable of storing smart contracts and receive Ether if there is any payable function in the smart contract.

If you are refering to why EOA don't have any smart contracts but capable of sending ETH to accounts, you can think transferring ETH is a built-in function.

And remember, EOA aren't capable of storing tokens such as USDT, BUSD, UNISWAP etc. In fact, they are stored in the ERC20 contract itself and mapped to your account through mapping datatype and showed in wallets after some filtering and all.

mapping(address => uint256) s_balances;

Typical ERC20 address to balance mapping.

More about accounts here. More about transactions here.

Tell me if it helps!

1
  • This was very informative, thank you. I have some follow-up questions though. 1) In your explanation, you mean that for EOA to EOA transaction contract is signed but no code is used? but isn't a contract the code? 2) Just for better understanding you say that transferring ETH in EOA is a build-in function which is a contract that says a transaction has occurred and signatures from EOAs are used to verify the transaction (like inputs to the function). Finally, 3)Since all transactions use smart contracts, does it mean that every transaction in Ethereum is executed by the EVM?
    – Joel254
    Oct 4, 2022 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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