0

I have a JSON array of the transactions from the listtransactions call. How do I calculate the balance of addresses?

My plan. 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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.