Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 108 additions & 7 deletions docs/references/subnets/subnet-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

<MarkdownChipRow labels={["Concept"]} />



A subnet on ICP is a collection of interacting replicas that run their own, separate instance of the ICP [consensus](https://learn.internetcomputer.org/hc/en-us/articles/34207558615956-Consensus) mechanism, effectively creating their own blockchain on which a set of canisters can run. Each subnet can communicate with other subnets and is controlled by a root subnet. The root subnet uses chain-key cryptography to delegate its authority to the various subnets.

You can learn more about subnets and how they work [here](/docs/building-apps/developing-canisters/create).
Expand Down Expand Up @@ -142,17 +140,120 @@ The current wallet settings are stored in your local file system in the file `$H
}
```

### Important notes about deploying to the European subnet
## The United States subnet

When deploying a project to the mainnet using dfx:
The 'United States' type subnet indicates that the subnet is comprised of only node machines located in the United States. This type of subnet allows for developers and enterprises to build applications that require certain infrastructure that meets certain compliance regulations.

- If your canisters have already been created, dfx will continue to deploy the canisters on the same subnet that they are already located on.
:::caution
The United States subnet enables applications to be compliant to certain US regulations, but developers and enterprises must take further measures to ensure that their applications meet all necessary compliance requirements.
:::

- If your canisters do not exist yet, when they are created dfx will create them on the same subnet as your wallet canister. It is recommended to consistently use the same wallet on the European subnet.
### Using a United States subnet

- If your canisters do not exist yet, you can specify the wallet canister that should be used to create them by using the `dfx deploy --wallet <WALLET_CANISTER_ID>`. This will create the new canisters on the same subnet where the specified `<WALLET_CANISTER_ID>` is located.
To find a list of all subnet types using dfx, the `dfx ledger` command can be used with the `show-subnet-types` argument:

```
dfx ledger --network ic show-subnet-types
```

This should return the output:

```
["european", "fiduciary", "unitedstates"]
```

### Creating developer identity for the United States subnet

This is an optional step; it is not required to create a new separate identity in order to use the United States subnet.

To create a new identity, use the `dfx identity new` command:

```
dfx identity new ic-european
```

Then, to use this identity, run the `dfx identity use` command:

```
dfx identity use ic-unitedstates
```

### Using a developer identity on the United States subnet

To use this identity as a controller of a canister, get the identity's principal with the command:

```
dfx identity get-principal
```

Save this principal ID to be used as the `CONTROLLER` value in a future step.

You can check the current balance for that principal by running the command:

```
dfx ledger --network ic balance
```

To top up your principal's balance, you can send cycles to the principal using the [NNS dapp](https://nns.ic0.app/wallet/), or [learn how to convert ICP tokens into cycles](/docs/tutorials/developer-liftoff/level-1/1.4-using-cycles#converting-icp-tokens-to-cycles).

### Creating a cycles wallet

If you'd like to create a new wallet on the United States subnet, run the following `dfx ledger` command:

```
dfx ledger --network ic create-canister --amount 0.5 --subnet-type unitedstates CONTROLLER
```

:::info
Please note that the cycles wallet will be removed from dfx in a future release.

It is recommended to use the cycles ledger instead, which does not require any specific flags for different subnet types.
:::

Replace `CONTROLLER` with the principal ID that you took note of earlier after running the `dfx identity get-principal` command.

Adjust the `--amount 0.5` to the number of ICP tokens that you want to send the new canister. More information can be found in the [documentation](/docs/building-apps/developer-tools/dfx/dfx-ledger/#options).

This command will return a canister ID. Using that canister ID, you can deploy the wallet canister code to the new canister with the command:

```
dfx identity --network ic deploy-wallet <WALLET_CANISTER_ID>
```

For example:

```
❯ dfx identity --network ic deploy-wallet nanx4-baaaa-aaaap-qb4sq-cai
Creating a wallet canister on the ic network.
The wallet canister on the "ic" network for user "ic-unitedstates" is "nanx4-baaaa-aaaap-qb4sq-cai"
```

Then, whenever you create new canisters using that `WALLET_CANISTER_ID`, the new canisters will be created on the same United States subnet.

You can check the wallet balance of the wallet canister with the command:

```
dfx wallet --network ic balance
```

The current wallet settings are stored in your local file system in the file `$HOME/.config/dfx/identity/<identity_name>/wallets.json`. The file's contents will resemble the following:

```json
{
"identities": {
"ic-unitedstates": {
"ic": "nanx4-baaaa-aaaap-qb4sq-cai"
}
}
}
```

## Important notes about deploying to specific subnets

When deploying a project to the mainnet using `dfx`:

- If your canisters have already been created, dfx will continue to deploy the canisters on the same subnet that they are already located on.

- If your canisters do not exist yet, when they are created, `dfx` will create them on the same subnet as your wallet canister. It is recommended to consistently use the same wallet when deploying to a specific subnet.

- If your canisters do not exist yet, you can specify the wallet canister that should be used to create them by using the `dfx deploy --wallet <WALLET_CANISTER_ID>`. This will create the new canisters on the same subnet where the specified `<WALLET_CANISTER_ID>` is located.