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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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:
balance: A scalar value equal to the number of Wei owned by this address. [...]
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.