I have a usecase where I have hundreds of Algorand addresses and I need to know for each of them if it is an address of a user account or of an App account ?
I’m looking for the fastest way to know this for many addresses by minimizing the number of calls to algod or indexer, and if possible make no call at all.
For info, I get all the addresses from the sender and receiver fields of payment transactions.
if this is an inner transaction, currently the sender can only be an application account or rekeyed to an application account (at the time of the transaction)
if this is not an inner transaction, currently the sender can only be a normal signature account, a multisig account, or a smart signature/logic sig account (or rekeyed to such an account at the time of the transaction)
If the address is a recipient, I think you would need to query the indexer endpoint /v2/accounts/{…} and check the sig-type field. I don’t think you can do it any other way.
Thanks Fabrice. The issue is that I collect all payment transactions as jsons with the indexer client (Python SDK) and I don’t think I can differentiate inner transactions from non inner ones with just the jsons objects.
If you really wanted to avoid calling out to indexer you could generate a lookup table of all the possible address. All the SDKs include a function for getting an address from an app ID.
Using this code, it took me two minutes on a M1 Pro to generate 100,000,000 addresses. The file (which is just an address per line) took up 5.5GB. Looking at Algoexplorer I’d guess you’d want to generate addresses from 1 to 1,000,000,000. This would take up roughly 55GB. Whether it’s worth it or not is up to you.
If you really wanted to optimize the size of the table you could figure out the first app ID with inner transactions and start from there.