6

My understanding of Bitcoin is that balances are not stored but are instead calculated by summing all in and out transactions.

Are Ether balances calculated in the same way or are they stored somewhere on the blockchain?

6

The related question linked in comments by Richard Horrocks answers the question pretty well IMO.

Here's what the Ethereum yellowpaper has to say about this (search for balance, it's hit number 2 ATM for me):

4.1. World State. [...] is a mapping between addresses [...] and account states. Though not stored on the blockchain, it is assumed that the implementation will maintain this mapping in a Merkle Patricia tree (trie [...]). The trie requires a simple database backend [...].

The account state comprises the following four fields:

nonce: [...]

balance: A scalar value equal to the number of Wei owned by this address. [...]

storageRoot: [...]

codeHash: [...]

In short, balances are not stored on the blockchain - that only contains transactions which "encode" state changes.

A "state database" is maintained by every node that cares to do so. In that database, the balances are stored.

  • Does this mean there are no SPV proofs possible in Ethereum? – Ini Apr 26 '18 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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