Q:

What is the difference between `balance`, `frozen_balance`, `staking_balance` and `delegated_balance`

In the delegates RPC results what is the difference between balance, frozen_balance, staking_balance and delegated_balance?

A:

The RPC descriptions in the documentations are generally pretty self explanatory but let's try to clear it up by an example.
Say I have a tz account that I own with a total of 11000 XTZ. I bake with this account. My friend Bob who has 5000 XTZ in a KT address, he delegates his funds for me to bake for his behalf. Though inconsequential, we combine for 2 rolls (8000 XTZ per roll).
balance (my own balance) is 11000
delegated_balance (how much I'm delegated, this case only from Bob) is 5000
staking_balance (the total counted for my baking, including Bob's) is 16000
Because I'm a baker, every time I bake a block or endorses, bonds are taken from my tz account and rewards are held. So imagine that I had made 10 endorsements and 1 block baked, bonds per endorsement and bake is 64 XTZ and 512 XTZ, its rewards are 2 XTZ and 16 XTZ, respectively.
bonds = 10 * 64 + 1 * 512 = 1152 XTZ
rewards = 10 * 2 + 1 * 16 = 36 XTZ
total frozen = 1152 + 36 = 1188 XTZ
frozen_balance (all frozen bonds and rewards [and fees]) is 1188
Note that because rewards are not counted towards your total balance until it is unlocked and bonds are still part of your balance (though inaccessible), your balance or staking_balance does not change even considering your bonds and rewards.

