Skip to content

Commit f7a3b39

Browse files
authored
docs: enhance network configuration examples in dfx migration guide (#285)
1 parent ccafdec commit f7a3b39

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

docs/migration/from-dfx.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,14 @@ canisters:
236236

237237
### Network Configuration
238238

239+
**Remote network example:**
240+
239241
**dfx.json:**
240242
```json
241243
{
242244
"networks": {
243245
"staging": {
244-
"providers": ["https://ic0.app"],
246+
"providers": ["https://icp-api.io"],
245247
"type": "persistent"
246248
}
247249
}
@@ -253,14 +255,70 @@ canisters:
253255
networks:
254256
- name: staging
255257
mode: connected
256-
url: https://ic0.app
258+
url: https://icp-api.io
257259
258260
environments:
259261
- name: staging
260262
network: staging
261263
canisters: [frontend, backend]
262264
```
263265

266+
**Testnet with root key:**
267+
268+
**dfx.json:**
269+
```json
270+
{
271+
"networks": {
272+
"testnet": {
273+
"providers": ["https://testnet.example.com"],
274+
"type": "persistent"
275+
}
276+
}
277+
}
278+
```
279+
280+
**icp.yaml:**
281+
```yaml
282+
networks:
283+
- name: testnet
284+
mode: connected
285+
url: https://testnet.example.com
286+
root-key: 308182301d060d2b0601040182dc7c05030102... # Hex-encoded root key
287+
```
288+
289+
**Local network with custom bind address:**
290+
291+
**dfx.json:**
292+
```json
293+
{
294+
"networks": {
295+
"local": {
296+
"bind": "127.0.0.1:4943",
297+
"type": "ephemeral"
298+
}
299+
}
300+
}
301+
```
302+
303+
**icp.yaml:**
304+
```yaml
305+
networks:
306+
- name: local
307+
mode: managed
308+
gateway:
309+
host: 127.0.0.1
310+
port: 4943
311+
```
312+
313+
**Key differences:**
314+
- dfx's `"type": "persistent"` maps to icp-cli's `mode: connected` (external networks)
315+
- dfx's `"type": "ephemeral"` maps to icp-cli's `mode: managed` (local networks that icp-cli controls)
316+
- dfx's `"providers"` array (which can list multiple URLs for redundancy) becomes a single `url` field in icp-cli
317+
- dfx's `"bind"` address for local networks maps to icp-cli's `gateway.host` and `gateway.port`
318+
- **Root key handling**: dfx automatically fetches the root key from non-mainnet networks at runtime. icp-cli requires you to specify the `root-key` explicitly in the configuration for testnets (connected networks). For local managed networks, icp-cli retrieves the root key from the network launcher. The root key is the public key used to verify responses from the network. Explicit configuration ensures the root key comes from a trusted source rather than the network itself.
319+
320+
**Note:** icp-cli uses `https://icp-api.io` as the default IC mainnet URL, while dfx currently uses `https://icp0.io`. Both URLs point to the same IC mainnet, but `https://icp-api.io` is the recommended API gateway. The implicit `ic` network in icp-cli is configured with `https://icp-api.io`.
321+
264322
## Features Not in icp-cli
265323

266324
Some dfx features work differently or aren't directly available:
@@ -505,7 +563,7 @@ During migration, you can use both tools side-by-side with some considerations:
505563

506564
**What works side-by-side:**
507565
- ✅ **Configuration files**: dfx uses `dfx.json`, icp-cli uses `icp.yaml` (no conflicts)
508-
- ✅ **Identities**: Both use the same keyring service (`internet_computer_identities`), so keyring-stored identities are accessible to both tools
566+
- ✅ **Identities**: Both store identities separately (dfx uses `internet_computer_identities` keyring service, icp-cli uses `icp-cli`), so they don't interfere with each other
509567
- ✅ **Canister IDs**: Stored in different locations (`.dfx/` vs `.icp/`), no conflicts
510568
- ✅ **Remote networks**: Both can deploy to IC mainnet independently
511569

0 commit comments

Comments
 (0)