I want to build a real-time Tezos yearly/monthly inflation calculator that updates for every block. While I have the rewards calculation under control I don't know how to calculate the total XTZ supply. I am aware that tzscan returns this value but want to calculate it myself with nothing more than the Tezos node RPC if possible. What are the steps to do this?
The protocol by itself does not track that number (though it would be useful if it did, for many reasons).
This leaves one option, use an indexer that tracks the total supply, and updates it block by block by analyzing how many tokens were created, and how many were burned.