ICP index local deployment

Is there documentation available for deploying and configuring the ICP ledger index canister locally?

I’ve created a script to deploy it locally in Juno (https://github.com/buildwithjuno/juno/blob/feat/index-canister/scripts/index.sh), but transactions aren’t syncing. :thinking:

Are the 55 ICP your balance on your local replica or on mainnet?

Everything local.

I send my local canister 55 ICP from the ledger with an ICRC-1 transfer using this script.


As far as I can see, there are two ledgers deployed, one being the one that comes with dfx (dfx ledger …) and then the ledger you deploy manually (dfx canister ledger …), are you sure you are indexing the correct one?

I would say yes, I use this script to deploy the index canister https://github.com/buildwithjuno/juno/blob/feat/index-canister/scripts/index.sh

#!/usr/bin/env bash

curl -o index.wasm.gz "https://download.dfinity.systems/ic/$IC_VERSION/canisters/ic-icp-index-canister.wasm.gz"
gunzip index.wasm.gz
curl -o index.did "https://raw.githubusercontent.com/dfinity/ic/$IC_VERSION/rs/rosetta-api/icp_ledger/index/index.did"

LEDGER_ID=$(dfx canister id ledger)

dfx deploy index --specified-id r7inp-6aaaa-aaaaa-aaabq-cai --argument '(record {ledger_id = principal"'${LEDGER_ID}'";})'

What does it say when you call the status endpoint of the index canister? Is it the same as that of your locally deployed ledger?
Also, which canister ID did you transfer ICP to? I believe you mixed up the two ledgers since you named them identically.
Try and name them differently, --specified-id does not guarentee the id will be set, it will just try to set. It is possible that the existing ledger and your locally deployed one have the same ledger id.

I can printout the canister IDs this evening but, I’m almost sure ledger ID I’m using are correct but, will printout.

I transfer to a canister ID because it’s the user’s canister that holds ICP. It’s correct, that’s deployed and bullet proofed on mainnet.

@NikolasHai here the IDs:

❯ ./scripts/index.sh
Deploying: index
Creating canisters...
Creating canister index...
index canister created with canister id: r7inp-6aaaa-aaaaa-aaabq-cai
Building canisters...
Installing canisters...
Installing code for canister index, with canister ID r7inp-6aaaa-aaaaa-aaabq-cai
Deployed canisters.
  Frontend canister via browser
  Backend canister via Candid interface:


ledger: ryjl3-tyaaa-aaaaa-aaaba-cai
index: r7inp-6aaaa-aaaaa-aaabq-cai

in addition output of dfx canister id ledger equals:

❯ dfx canister id ledger

So canister IDs are correct in my opinion.

I also double checked the JavaScript code, I correctly query the index canister ID equals to r7inp-6aaaa-aaaaa-aaabq-cai

I just ran through the deploying and synching of a locally set-up ledger and index successfully and I can see there are a couple of issues with your code.

  1. You are using an old IC Version: Try the lates → Releases - ICP Dashboard
  2. The file ledger.private.did does no longer exist, just use the public one
  3. The guide for local ledger setup you are following has been updated since you last used it. Here is the new guide: Ledger local setup | Internet Computer
  4. The arguments to deploy the ledger are wrong. You can see in the guide it is now a variant instead of just a record.

If you change these things it should work. Let me know what your result is.


There now also exists a tutorial on how to deploy and connect the ICP index canister locally:


Thanks @NikolasHai , it worked out :white_check_mark:

Upgrading the ledger to a most recent version probably fixed the issue.

Currently got that in a branch but if anoyone is interested, here two bash scripts to deploy ledger and index: