Get balance of specific Address

Hello again :slight_smile:

I’m interested in making a little script that gets the actual balance of a Cardano wallet, by their address.

I’ve achieved to get transactions the following command:

cardano-cli query utxo --address ${ADDRESS} --mainnet

  TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
ADDRESS                              4               1500000 lovelace

As of today, I’ve only made one transaction. I sent 1.5 ADA to this account. So getting the balance it’s easy.

But what about if this transactions ends up getting up to thousands of transactions. Is this the only method of getting the balance? By adding/deducting in/out transactions and get the final add-up of all the math done.

Or is there an easier command-line tool to get the full transaction of an address?

Thanks in advance.