# Ledger Canister not deploying

**URL:** <https://forum.dfinity.org/t/ledger-canister-not-deploying/24563>\
**Category:** Motoko\
**Created:** [November 10, 2023, 11:22am UTC](https://forum.dfinity.org/t/ledger-canister-not-deploying/24563 "2023-11-10T11:22:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![successaje](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/successaje/32/7924_2.png) [@successaje](https://forum.dfinity.org/u/successaje)\
**Post date:** [November 10, 2023, 11:22am UTC](https://forum.dfinity.org/t/ledger-canister-not-deploying/24563/1 "2023-11-10T11:22:10Z")

</div>

I get this error when i try to deploy the ledger canister while following the instructions on the [IC docs](https://internetcomputer.org/docs/current/developer-docs/integrations/ledger/ledger-local-setup).  
what am i possibly doing wrong

```auto
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

```

---

<div class="post-metadata">

**Author:** ![successaje](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/successaje/32/7924_2.png) [@successaje](https://forum.dfinity.org/u/successaje)\
**Post date:** [November 10, 2023, 11:54am UTC](https://forum.dfinity.org/t/ledger-canister-not-deploying/24563/2 "2023-11-10T11:54:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zohaib29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zohaib29/32/29625_2.png) [@zohaib29](https://forum.dfinity.org/u/zohaib29)\
**Post date:** [November 10, 2023, 12:19pm UTC](https://forum.dfinity.org/t/ledger-canister-not-deploying/24563/3 "2023-11-10T12:19:21Z")

</div>

Step:1 Run this script to get the ledger wasm

```auto
#!/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](https://raw.githubusercontent.com/dfinity/ic/d87954601e4b22972899e9957e800406a0a6b929/rs/rosetta-api/icp_ledger/ledger.did)

Step3: Configure your dfx.json

Step 4: Deploy the ledger canister using this script

```auto
#!/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

```

---

<div class="post-metadata">

**Author:** ![successaje](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/successaje/32/7924_2.png) [@successaje](https://forum.dfinity.org/u/successaje)\
**Post date:** [November 10, 2023, 6:07pm UTC](https://forum.dfinity.org/t/ledger-canister-not-deploying/24563/4 "2023-11-10T18:07:57Z")

</div>

Ohh thanks, this works now.

How come the one in the documentation doesnt??
