Ledger Canister not deploying

I get this error when i try to deploy the ledger canister while following the instructions on the IC docs.
what am i possibly doing wrong

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 'icp_ledger_canister'.
      Failed during wasm installation call: The replica returned a replica error: Replica Error: reject code CanisterError, reject message Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Unable to decode init argument.
Decode as new init returned the error Fail to decode argument 0 from table0 to variant {
  Upgrade : opt record {
    maximum_number_of_accounts : opt nat64;
    icrc1_minting_account : opt record {
      owner : principal;
      subaccount : opt vec nat8;
    };
    feature_flags : opt record { icrc2 : bool };
  };
  Init : record {
    send_whitelist : vec principal;
    token_symbol : opt text;
    transfer_fee : opt record { e8s : nat64 };
    minting_account : text;
    maximum_number_of_accounts : opt nat64;
    accounts_overflow_trim_quantity : opt nat64;
    transaction_window : opt record { secs : nat64; nanos : nat32 };
    max_message_size_bytes : opt nat64;
    icrc1_minting_account : opt record {
      owner : principal;
      subaccount : opt vec nat8;
    };
    archive_options : opt record {
      num_blocks_to_archive : nat64;
      max_transactions_per_response : opt nat64;
      trigger_threshold : nat64;
      max_message_size_bytes : opt nat64;
      cycles_for_archive_creation : opt nat64;
      node_max_memory_size_bytes : opt nat64;
      controller_id : principal;
    };
    initial_values : vec record { text; record { e8s : nat64 } };
    token_name : opt text;
    feature_flags : opt record { icrc2 : bool };
  };
}
Decode as old init returned the error Fail to decode argument 0 from table0 to record {
  send_whitelist : vec principal;
  token_symbol : opt text;
  transfer_fee : opt record { e8s : nat64 };
  minting_account : text;
  maximum_number_of_accounts : opt nat64;
  accounts_overflow_trim_quantity : opt nat64;
  transaction_window : opt record { secs : nat64; nanos : nat32 };
  max_message_size_bytes : opt nat64;
  icrc1_minting_account : opt record {
    owner : principal;
    subaccount : opt vec nat8;
  };
  archive_options : opt record {
    num_blocks_to_archive : nat64;
    max_transactions_per_response : opt nat64;
    trigger_threshold : nat64;
    max_message_size_bytes : opt nat64;
    cycles_for_archive_creation : opt nat64;
    node_max_memory_size_bytes : opt nat64;
    controller_id : principal;
  };
  initial_values : vec record { text; record { e8s : nat64 } };
  token_name : opt text;
  feature_flags : opt record { icrc2 : bool };
}, error code None

I have also tried using lower versions of dfx but the error persists

Step:1 Run this script to get the ledger wasm

#!/bin/bash

export IC_VERSION=d87954601e4b22972899e9957e800406a0a6b929

curl -o ledger.wasm.gz https://download.dfinity.systems/ic/$IC_VERSION/canisters/ledger-canister.wasm.gz

gunzip ledger.wasm.gz

Step2: You can get the candid file from here

Step3: Configure your dfx.json

Step 4: Deploy the ledger canister using this script

#!/bin/bash

# Switching to Minter Identity
echo -e "\n Switching identity to Minter Princicpal......"

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

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

ARCHIVE_CONTROLLER=$(dfx identity get-principal)
export ARCHIVE_CONTROLLER

export TOKEN_NAME="ICP"
export TOKEN_SYMBOL="ICP"

# dfx canister uninstall-code icp_ledger

dfx deploy icp_ledger --argument "(variant {Init =record {minting_account = \"${MINT_ACC}\";
initial_values = vec { record {  \"${LEDGER_ACC}\";
record { e8s=100_000_000_000 } } } ; archive_options = opt record {num_blocks_to_archive = 1000000; trigger_threshold = 1000000; \
  controller_id = principal  \"${ARCHIVE_CONTROLLER}\"; }; send_whitelist = vec {}}})" --specified-id ryjl3-tyaaa-aaaaa-aaaba-cai
2 Likes

Ohh thanks, this works now.

How come the one in the documentation doesnt??