Verifying balances on the blockchain

How are wallet balances calculated on the Algorand blockchain?

Say our community is currently trying to generate block #B of the blockchain. In order to validate the transactions on block B, we need to know that the pre-payment balances of all payers involved in block B exceeds the amounts they’re paying. How these balances kept track of on the Algorand blockchain?

You could, as a starting point, say that everyone’s balance right before the genesis block was 0. But not keeping a more recent running total of everyone’s balance is very computationally inefficient. e.g. let’s suppose Algorand aspires to have the throughput of an enormous network, e.g. Visa. Then, assuming 10K transactions per second, there would be about 3.15 * 10^11 transactions each year. Assuming that high throughput, to calculate up-to-date balances from scratch would require, at the very least, reading 3.15 * 10^11 transaction lines…that becomes intractable at a certain point (in the not-too-distant future, I hope).

…you could circumvent this problem by appending an up-to-date balance sheet at the end of every block (or at least every so often).

Can anybody confirm: is calculating these up-to-date balance sheets part of the Algorand blockchain protocol? Or are balance sheets being calculated from scratch with every new block?!

Nodes keep track of balances at every time.
When a node syncs to the blockchain, they read the transactions and update the “account table”, that is the balances in this account table (and also other information such as smart contract state, key registration for consensus, …).

This account table is, to my knowledge, not part of the block directly. But anyone syncing with the blockchain can easily recompute it.
Syncing itself takes a long time as you need to process all the transactions from the beginning.
But once synced, everything is very fast as all balances are stored.

You don’t need to recompute the balances from scratch for every block, you just need to update the account tables with the new transactions.