I have a general question about calculating account balances in the new world of sharding. In the Bitcoin blockchain, in order to accurately calculate someone's wallet balance, you have to analyze every transaction in the blockchain (correct me if I'm wrong on this as it's the basis for my next question). So in Ethereum does sharding impede the effort of trying to calculate someone's wallet balance because instead of going to a single node to analyze the entire blockchain, you have to traverse the blockchain as its spread out over hundreds of nodes where each shard lives?
-
Adding to @flygoing answer, this is all still being worked on, for example users may have balances on different shards and would select which shard they want to view their balance on, rather than the wallet traversing all shards to present a single balance.– eth ♦Commented Jul 5, 2019 at 1:19
1 Answer
Since Ethereum has an account based architecture instead of UTXO based, it's actually not currently required to traverse the entire history to generate an up-to-date UTXO set like in Bitcoin. Each block in Ethereum has the root hash of the state trie, which includes account balances, so all you need to do in Etheruem to know any accounts balance is to download the latest block and its state.
This is also the case in Sharding. Since in the existing Serenity spec, accounts live on 1 shard (accounts aren't cross-shard, but of course can communicate across shards). This means you can do the same thing as in the existing system where you just download the latest block and the state tree in it.