Error deploying the ledger locally: "No more values on the wire"

I try to deploy the ledger locally as displayed in the documentation ( but get an issue "Deserialization Failed: “No more values on the wire, the expected type record”. Any idea?

The doc as script:

#!/usr/bin/env bash

# Install ledger locally as documented in:

curl -o ledger.wasm.gz "$IC_VERSION/canisters/ledger-canister_notify-method.wasm.gz"
gunzip ledger.wasm.gz
curl -o ledger.private.did "$IC_VERSION/rs/rosetta-api/ledger.did"
curl -o ledger.public.did "$IC_VERSION/rs/rosetta-api/ledger_canister/ledger.did"

dfx identity new minter
dfx identity use minter
MINT_ACC=$(dfx ledger account-id)

dfx identity use default
LEDGER_ACC=$(dfx ledger account-id)

dfx deploy ledger --argument '(record {minting_account = "'${MINT_ACC}'"; initial_values = vec { record { "'${LEDGER_ACC}'"; record { e8s=100_000_000_000 } }; }; send_whitelist = vec {}})'

The error

Installing code for canister ledger, with canister ID qsgjb-riaaa-aaaaa-aaaga-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed while trying to install all canisters.
Failed to install wasm module to canister ‘ledger’.
Failed to install wasm in canister ‘qsgjb-riaaa-aaaaa-aaaga-cai’.
Failed to install wasm.
The Replica returned an error: code 5, message: “Canister qsgjb-riaaa-aaaaa-aaaga-cai trapped explicitly: Panicked at ‘Deserialization Failed: “No more values on the wire, the expected type record {\n send_whitelist : vec principal;\n token_symbol : opt text;\n transfer_fee : opt record { e8s : nat64 };\n minting_account : text;\n transaction_window : opt record { secs : nat64; nanos : nat32 };\n max_message_size_bytes : opt nat64;\n archive_options : opt record {\n num_blocks_to_archive : nat64;\n trigger_threshold : nat64;\n max_message_size_bytes : opt nat64;\n cycles_for_archive_creation : opt nat64;\n node_max_memory_size_bytes : opt nat64;\n controller_id : principal;\n };\n initial_values : vec record { text; record { e8s : nat64 } };\n token_name : opt text;\n} is not opt, reserved or null”’, /ic/rs/rust_canisters/dfn_core/src/”

Found it. The issue is that you have to configure dfx.json twice as displayed in the documentation.

  1. First with a private did
  "canisters": {
    "ledger": {
      "type": "custom",
      "wasm": "ledger.wasm",
      "candid": "ledger.private.did"
  1. then install ledger

  2. then update again dfx.json

"ledger": {
  "type": "custom",
  "candid": "ledger.public.did",
  "wasm": "ledger.wasm",
  "remote": {
    "candid": "ledger.public.did",
    "id": {
      "ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"