# Ledger-transfer demo cannot be deployed

**URL:** <https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423>\
**Category:** Language Support\
**Tags:** Motoko, Wasm\
**Created:** [July 16, 2023, 7:29am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423 "2023-07-16T07:29:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![haida](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@haida](https://forum.dfinity.org/u/haida)\
**Post date:** [July 16, 2023, 7:29am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/1 "2023-07-16T07:29:04Z")

</div>

> <https://github.com/dfinity/examples/tree/master/motoko/ledger-transfer>
>
> //github.com/dfinity/examples/tree/master/motoko/ledger-transfer

```auto
export IC_VERSION=dd3a710b03bd3ae10368a91b255571d012d1ec2f
curl -o ledger.wasm.gz "https://download.dfinity.systems/ic/$IC_VERSION/canisters/ledger-canister_notify-method.wasm.gz"
gunzip ledger.wasm.gz
curl -o ledger.private.did "https://raw.githubusercontent.com/dfinity/ic/$IC_VERSION/rs/rosetta-api/ledger.did"

```

Some link addresses in it have expired, and my parameters are better and the latest IC\_VERSION, but dfx deploy ledger --argument xxx, the argument has changed,  
In the end I tried a lot of adjustments but couldn’t deploy successfully locally!

Can you help us update a new usable demo?

---

<div class="post-metadata">

**Author:** ![haida](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@haida](https://forum.dfinity.org/u/haida)\
**Post date:** [July 16, 2023, 7:37am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/2 "2023-07-16T07:37:33Z")

</div>

It seems that the argument rules of the new version have changed, and various errors still appear after trying to adjust. It took me a lot of time and made me very painful. I hope you can help me.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [July 17, 2023, 9:47am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/3 "2023-07-17T09:47:11Z")

</div>

I got it to install with `dfx canister install ledger --argument "(variant {Init = record { token_name = \"NAME\"; token_symbol = \"SYMB\"; transfer_fee = 1000000; metadata = vec {}; minting_account = record {owner = principal \"$(dfx --identity minter identity get-principal)\";}; initial_balances = vec {}; archive_options = record {num_blocks_to_archive = 1000000; trigger_threshold = 1000000; controller_id = principal \"$(dfx identity get-principal)\"}; }})"`

---

<div class="post-metadata">

**Author:** ![haida](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@haida](https://forum.dfinity.org/u/haida)\
**Post date:** [July 17, 2023, 12:49pm UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/4 "2023-07-17T12:49:14Z")

</div>

Error reporting：

```auto
Error: Failed to install wasm module to canister 'ledger'.
Caused by: Failed to install wasm module to canister 'ledger'.
  Failed during wasm installation call: The replica returned a replica error: Replica Error: reject code CanisterError, reject message Canister bkyz2-fmaaa-aaaaa-qaaaq-cai trapped explicitly: Unable to decode init argument.
Decode as new init returned the error No more values on the wire, the expected type variant {
  Upgrade : opt record {
    maximum_number_of_accounts : opt nat64;
    icrc1_minting_account : opt record {
      owner : principal;
      subaccount : opt vec nat8;
    };
  };
  Init : record {
    send_whitelist : vec principal;
    token_symbol : opt text;
    transfer_fee : opt record { e8s : nat64 };
    minting_account : text;
    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;
  };
} is not opt, reserved or null
Decode as old init returned the error No more values on the wire, the expected type record {
  send_whitelist : vec principal;
  token_symbol : opt text;
  transfer_fee : opt record { e8s : nat64 };
  minting_account : text;
  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;
} is not opt, reserved or null, error code None

```

---

<div class="post-metadata">

**Author:** ![benji](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/benji/32/8069_2.png) [@benji](https://forum.dfinity.org/u/benji)\
**Post date:** [July 17, 2023, 12:52pm UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/5 "2023-07-17T12:52:27Z")

</div>

If you use the latest ledger implementation, then some init parameters have changed and you’d need to adjust accordingly.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [July 17, 2023, 12:53pm UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/6 "2023-07-17T12:53:24Z")

</div>

I’m using this ledger version:

```auto
    "ledger": {
      "type": "custom",
      "candid": "https://raw.githubusercontent.com/dfinity/ic/a17247bd86c7aa4e87742bf74d108614580f216d/rs/rosetta-api/icrc1/ledger/ledger.did",
      "wasm": "https://download.dfinity.systems/ic/a17247bd86c7aa4e87742bf74d108614580f216d/canisters/ic-icrc1-ledger.wasm.gz",
      "remote": {
        "id": {
          "ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"
        }
      }

```

---

<div class="post-metadata">

**Author:** ![haida](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@haida](https://forum.dfinity.org/u/haida)\
**Post date:** [July 17, 2023, 2:05pm UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/7 "2023-07-17T14:05:47Z")

</div>

Thank you! Successfully deployed!

But the ‘transfer’ interface function is no longer available, has it been replaced with ‘icrc1\_transfer’ now?

```auto
service : (ledger_arg : LedgerArg) -> {
    icrc1_name : () -> (text) query;
    icrc1_symbol : () -> (text) query;
    icrc1_decimals : () -> (nat8) query;
    icrc1_metadata : () -> (vec record { text; MetadataValue }) query;
    icrc1_total_supply : () -> (Tokens) query;
    icrc1_fee : () -> (Tokens) query;
    icrc1_minting_account : () -> (opt Account) query;
    icrc1_balance_of : (Account) -> (Tokens) query;
    icrc1_transfer : (TransferArg) -> (TransferResult);
    icrc1_supported_standards : () -> (vec record { name : text; url : text }) query;
    get_transactions : (GetTransactionsRequest) -> (GetTransactionsResponse) query;
    get_blocks : (GetBlocksArgs) -> (GetBlocksResponse) query;  
    get_data_certificate : () -> (DataCertificate) query;    
}

```

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [July 17, 2023, 2:37pm UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/8 "2023-07-17T14:37:36Z")

</div>

Yes. I suggest you use the icrc1\_transfer, but I _think_ the original ‘transfer’ function may still be in the wasm, even though it’s not advertised anymore

---

<div class="post-metadata">

**Author:** ![haida](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@haida](https://forum.dfinity.org/u/haida)\
**Post date:** [July 19, 2023, 2:35am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/9 "2023-07-19T02:35:09Z")

</div>

> [@Vivienne](#):
>
> ```auto
> "remote": {
> "id": {
> "ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"
> }
> 
> ```

Regarding the “remote” in the configuration, I know it should be the ledger IC address, but how do I switch to call the ic ledger or the local ledger?  
Or is it deployed to the IC network to automatically point to the ic ledger?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [July 19, 2023, 6:44am UTC](https://forum.dfinity.org/t/ledger-transfer-demo-cannot-be-deployed/21423/10 "2023-07-19T06:44:29Z")

</div>

> [@haida](#):
>
> Or is it deployed to the IC network to automatically point to the ic ledger?

Correct. `dfx build` injects environment variables corresponding to the selected network’s canister ids, which the compiler(s) will pick up and hard-code into the wasm
