The canister in question will create one sub-account for each user (similar to the suggestion discussed in this thread: Create ICP Account from within a smart contract for each user);
How do I list/enumerate the sub-accounts controlled by a canister or its principal ID?
You can’t list them. You need a way to recover them. What most canisters will do is to keep a list of users and then calculate the list of accounts from the users. This will give you all the accounts.
I see – thank you very much indeed!
How expensive / viable is it to keep bigger chunks of data in a canister? Let’s say I have 100K users? Or even a million? Is it feasible to keep them in a canister?
The canister has 4GB of live memory and 8GB of stable memory available. That should be more than enough to store all the info you need. I suggest to use live memory but then remember to copy it to/from the stable one during upgrade calls.
The canister should never use more memory than it has available. If you think you’ll need more then you should consider scaling your services storage on multiple canisters.
This is very helpful! Thank you again
@mariop let’s say the canister uses the full 4GB of live memory: how much does this cost per hour or per day?
More generally: how does one estimate the cost of storage for canister memory?
For storage the current costs are about 5USD/GB per year.
More generally, the costs of the various resources a canister may use are here. The costs are in cycles (10^12 cycles ~ 1.2 USD).
Thank you – that’s pretty affordable