Could we deploy a canister on a specified subnet?

Could we deploy a canister on a specified subnet?
If we can, when can we deploy a canister on a specified subnet?

2 Likes

This is currently not possible but we recognise that this is a problem. We hope to be able to allow users to deploy canisters to specific subnets in the near future.

4 Likes

This would be the opposite of the serverless philosophy. Ideally, I’d want to just deploy to the IC and have it figure out the details. I imagine people want to deploy to specific subnets to subvert the issues plaguing pjljw or the like. While other seemingly empty subnets are available.

3 Likes

While not a perfect solution, you can use the dfx ledger create-canister command to create an empty canister (which will be created on a random subnet), check on ic.rocks or the ICA dashboard to see where the canister has been created, and if it was created on a desired subnet, deploy a cycles wallet to that canister using dfx identity --network ic deploy-wallet <canister id>. Once the cycles wallet is deployed, any canisters created from that cycles wallet will be on the same subnet. I’ve done this and it works! More info on the create-canister command here: dfx ledger :: Internet Computer

6 Likes

I consider this a bug (or missing feature): If I create a new canister through a wallet, and the subnet with that wallet is already full, or generally more busy than some other subnet, then I would expect the new canister to be transparently be installed on that subnet (echoing @saikatdas0790’s sentiments). At least “create that canister wherever possible” should be the default, and “create that canister on the same subnet as canister X” or “create this canister on a subnet other than canister X, Y, Z (for load balancing)” or “create this canister on a subnet with at least n nodes” or other subnet indications an optional setting. And I hope we aim for such declarative settings, and not just a blunt and inflexible “create on subnet X”.

1 Like

:wave: hey all! Just wanted to check the status of this.

Good question. Let me ping internally as well.

1 Like

We have a proposed feature to allow the caller to specify a subnetwork on which to install a newly created canister. The feature would also require to expose via the dashboard a variety of attributes of subnetworks (like replication factor, availability of threshold ECDSA on that subnetwork, subnetwork load etc), which should allow for a somewhat informed decision.

3 Likes

Wonderful, would I be able to use this feature on chain? For me this is critical.

Also, is there a timeline associated with this or is it just proposed?

3 Likes

Yes, canisters should be able to make such canister creation requests – however in the first iteration it is likely that a canister would not be able read up-to-date subnetwork info so that may need to be fed “manually”. In the long term, we should expose subnetwork info on chain (there’s more than one usecase for this).
There is no timeline unfortunately at the moment.

2 Likes

I want some extra information for this, im unable to check wallet_create_canister method in motoko , do you have some example for that, already tried to use it according to docs, getting some error…
if you could help with that :
Blog for error

Just wanted to check the status of this.

1 Like

In case if it helps, we can create new canisters in the subnet of an already existing canister. Meaning, you can use management canisters create_canister method from an already existing canister, and new canisters will get created in the same subnet.

No specific subnet is possible (yet?), but you can choose the subnet type with dfx ledger create-canister --subnet-type <type>

To see available options, use dfx ledger --network ic show-subnet-types. No option means application

4 Likes

Thank you very much. I am amazed. But it is not the best for me.

@Severin
Should I do create-canister and then deploy-wallet?
If I do dfx deploy, will it deploy to the same subnet as the one the wallet was deployed to?

dfx identity --network ic deploy-wallet

Only if you want your cycles wallet to be on that subnet as well. It’s a little bit more expensive, but I don’t think that’s a reason not to.

  • If the canisters are already created, it will deploy to the already created ones, no matter which subnet they are on.
  • If the canisters don’t exist yet, it will create them on the same subnet as your default wallet
  • If the canisters don’t exist yet, and you use dfx deploy --wallet <some wallet id> it will create the canisters on the same subnet as <some wallet id> is located in

@Severin
Thank you for your reploy. I understood.
Do you think the following way is also possible?

dfx ledger create-canister --subnet-type fiduciary
I secure a CanisterID with the above. I run dfx deploy using the Application Subnet wallet, specifying the CanisterID in canister_ids.json. The new canister is deployed to the fiduciary.

Is the CanisterID unique across all subnets?

1 Like

Yes, this works exactly the way you described

Yes

1 Like

is there a way to create canister on different subnet programmatically using ic-cdk?