Cardano-cli-js Wallet.balance() is very slow

I want to get balance of my wallet with this code:


But this code takes time about 3 seconds!
How can I improve it?

Since cardanocli-js is just a wrapper around cardano-cli and that one has no efficient away to query the balance of a wallet, it is very possible that there simply is no faster way.

cardano-cli query utxo is also very slow and to get the balance of a wallet that has to be done for all addresses of the wallet.

You maybe want to look into other possibilities like using the or APIs (with the added benefit that you do not need to run a node).


Thank you
So, how is fast?!
How can I fast like

You could install cardano-db-sync ( in parallel to the cardano-node. It extracts the information from the blocks of the blockchain into a Postgres database that you can then query pretty fast.

CNCLI ( synchronises into a SQLite database, but it is more targeted to node operators and I don’t know if all transactions and balances are available in that database.

Both will require a considerable amount of disk space in addition to the soon to be 100 GiB that the node itself already needs.

1 Like