I'm writing an application that attempts to calculate the running balance of a given BTC address by looking at data including block height, input amount, output amount, etc. However, I'm not certain about the logic involved here. Would it be possible to create this running balance by checking an input/output address and then tracking the input/output amount?
Here's a quick sample of the data that I'm looking:
BLOCK_DATE | BLOCK_HEIGHT | TRANS_HASH | INPUT_ADDRESS | OUTPUT_ADDRESS | INPUT_AMOUNT | OUTPUT_AMOUNT
01/11/2020 190 15c7853 abc xyz1 -0.01 0.0001
01/11/2020 190 14v9876 abc xyz2 -0.50 0.70
01/11/2020 191 19vc842 abc xyz3 -5.03 0.413
01/12/2020 192 20ff4d3 abc xyz4 -0.06 0.201
01/12/2020 192 154gf34 xyz1 abc -0.07 0.18
01/12/2020 192 45f4ti5 ggg abc -0.10 0.24
01/12/2020 192 33cv5c5 jjj abc -0.08 1.13
So using this dummy data, how would I go about calculating the running balance for address abc? I know that the input/output isn't necessarily 1:1 and there are some nuances here that make it more complex than this. So I'm not sure if I could do something straightforward like sum all of the inputs and outputs for a given address.