Multi canister architecture: how to create a master canister with Motoko?

Hey everybody, I am building a dapp, a token marketplace to be precise, and I have realized that for scalability, I need to use one canister per user and one canister per token. I saw that in the OpenChat architecture they do this, however, I still don’t understand if they use kind of a ‘master canister’ that creates the other canisters or how do they do it. I am coding in Motoko.

Does anyone have any code I could look at or documentation?

1 Like did a series of bounties on this last year. You can find a bunch of examples here:


Thank you. It has been really helpful to browse through the OpenChat architecture post as well. However, I have some questions regarding pricing and costs. How could I calculate to some degree the cost of having this indexing-autoscaling architecture? I do want to make my dapp as scalable as possible, but I am aware that OpenChat has much more users than I probably will have at first. I am just wondering if its not smart to make it as scalable as posible at first… any advice?

It depends on how much processing and storage you’re going to have on each canister. Provided each starts very low, then your estimation is just how many cycles you need to spin up each canister. At one point I thought it required 2 trillion cycles to start a canister but I don’t think that’s the case if you’re using a spawning method. I’d try to find a solution that puts as Few cycles as possible on each new canister, and then only add more cycles, if the user engages.


Thanks. Do you have any resources with good info on this topic? To make an estimation.