2

Each account (no matter EOA or contract) has 4 fields: balance, nonce, codeHash, storageRoot. However, codeHash and storageRoot are meaningful only in contract accounts. There is no code in EOA, and there's no way to modify EOA's storage.

Is my understanding correct? If correct, then why is Ethereum not designed to be like this: EOA has only nonce and balance fields, and contract account has all 4 fields.

I know it is nice to make two kinds of accounts look the same from programming perspective (e.g., they share the same structure). But I believe it's also nice enough to distinguish these two kinds, and it won't bring too much programming complexity.

So what's the reason to make these two kinds look the same? Is it a design bug? Thanks in advance :)

1 Answer 1

3

In the early Ethereum development there was the idea to make EOAs programmable: "account abstraction", so they had the same fields that contracts.

It is good to have both sharing the same interface. For most cases you don't need to make a distinction between contracts and non-contracts.

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.