2

The official iota-cli app on the IOTA repo has a balance command which is supposed to calculate the balance for the logged in seed.

Sometimes, the command takes ages. I wondered and looked into the code. It seems, as if the balances command first calls getNewAddress. Why is that?

Here is the code: https://github.com/iotaledger/cli-app/blob/9266d7af4de57be0f70ce5b8778981301d5c0657/lib/commands/balance.js#L26

2

When you call getNewAddress with returnAll: true, it will not only return the new address but all other addresses before that one too. And you have to know all addresses to be able to ask for their balances.

getNewAddress will not attach the new address or anything, just compute addresses until it finds one that has never been used before i.e. findTransactions doesn't return any transactions.

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.