Smart way to find next unused seed derived address

How do you determine on the client the next free seed derived address? In SmartVoting I test them all (bib32 indexes) until I find the first unused address. I could make they loop smarter… But is there a smarter way, eg used by the client? Thx

The wallet has no “smart loop”. It just starts at the provided index (0 by default), derives the account id, and calls the API (request getAccountPublicKey) to check whether that address is published on the blockchain.

I can’t think of a faster way unless you store the “next free index” in some place (like data cloud or alias).

Thanks for the answer. It’s surprisingly fast! Ok, I didn’t try to create a new address with a SEED having 20k accounts created. I’ll try that.
Otherwise I’ll just optimize my loop to make it faster. Was just wondering if there was some hidden API call… :smiley:
Thank you Sergi!

1 Like