How do I calculate the balance of addresses.
You don't.
There is nothing interesting about the balance of an address.
You may care about how much money you have in your wallet overall; for that, there is the getbalance
RPC call.
You may also care about whether a particular payment was received (identified by the address you gave out for that particular invoice). You can use the getreceivedbyaddress
RPC.
Add up the amounts from all transactions of the receive category for a given address and filtering out transactions that have less than the minimum required confirmations. Is there anything I'm missing or any gotcha's here.
That will work, but essentially do the same as getreceivedbyaddress
. It won't give you a balance, just how much was received.