Where does "dfx nns install" save the list of canister ids?

When I run dfx nns install, where does dfx save the list of canister ids that have been deployed locally?

1 Like

The canister IDs are specified in this file: ic/canister_ids.json at master · dfinity/ic · GitHub

Moreover, they’re also produced by dfx nns install at the end of the output:

######################################
# NNS CANISTER INSTALLATION COMPLETE #
######################################

Backend canisters:
nns-registry          rwlgt-iiaaa-aaaaa-aaaaa-cai
nns-governance        rrkah-fqaaa-aaaaa-aaaaq-cai
nns-ledger            ryjl3-tyaaa-aaaaa-aaaba-cai
nns-root              r7inp-6aaaa-aaaaa-aaabq-cai
nns-cycles-minting    rkp4c-7iaaa-aaaaa-aaaca-cai
nns-lifeline          rno2w-sqaaa-aaaaa-aaacq-cai
nns-genesis-token     renrk-eyaaa-aaaaa-aaada-cai
nns-identity          rdmx6-jaaaa-aaaaa-aaadq-cai
nns-ui                qoctq-giaaa-aaaaa-aaaea-cai
nns-sns-wasm          qaa6y-5yaaa-aaaaa-aaafa-cai
nns-ic-ckbtc-minter   qjdve-lqaaa-aaaaa-aaaeq-cai


Frontend canisters:
internet_identity     http://qhbym-qaaaa-aaaaa-aaafq-cai.localhost:8080/
nns-dapp              http://qsgjb-riaaa-aaaaa-aaaga-cai.localhost:8080/

Thanks for the answer, that helps but not entirely.

The goal is to make the build process (webpack, vite etc.) of any developers’ dapps - that would have use dfx nns install - read and load these canister IDs.

e.g. with webpack, the developer should be able to use process.env.LEDGER_CANISTER_ID in his/her javascript fontend code.

So, that’s why I am asking where this list of canister ids is deployed and save locally - i.e. in which local file?

Otherwise, if I get you right, it means that the IDs should either be hardcoded or the build process should download through Http the ic/canister_ids.json before reading these.

The NNS canister IDs are fixed and thus could be hardcoded.

1 Like

Ok so either hardcoded or download and interpret that ic/canister_ids.json file but, I understand there is no local file to query. Thank you for the confirmation.

1 Like

if you do dfx nns import you’ll get the canister IDs into your dfx.json, which you can then query with either jq or dfx canister id <name>

Thanks @Severin. I though about it too, good point but I should have add to my question that I tried to use dfx nns install only for simplicity reason to deploy locally a subset of those that are deployed.

e.g. using nns install just to deploy II, ledger and Cmc locally without caring about all the other canisters.

So in that sense, running dfx nns import and loading the config with all canisters would not 100% accurate but, agree that’s an option too.