ICRC ledger mint errors

Hello, I created the icrc ledger locally, set the decimals to 18, and then used the miner account mint token 1_000_000_000_000_000_000. It prompted me that the balance was insufficient, but I could succeed with a smaller amount. What seems to be a setting problem?

This is wrong information:

Sending the following argument:
(
record {
to = record {
owner = principal “ymrve-y36j2-eohzd-6m7b7-ki7go-tszqq-gwjjm-mbq25-vff5f-dlw7a-iae”;
subaccount = null;
};
fee = null;
memo = null;
from_subaccount = null;
created_at_time = null;
amount = 100_000_000_000_000_000_000 : nat;
},
)

Do you want to send this message? [y/N]
y
(variant { Err = variant { InsufficientFunds = record { balance = 0 : nat } } })

1 Like

did you mint 1 token and try to send 100?

no, i use a minter account transfer, this is my step:

dfx identity use minter_account
dfx canister call my_ledger icrc1_transfer

the same operation,just the amount is low will success.

Sending the following argument:
(
record {
to = record {
owner = principal “ymrve-y36j2-eohzd-6m7b7-ki7go-tszqq-gwjjm-mbq25-vff5f-dlw7a-iae”;
subaccount = null;
};
fee = null;
memo = null;
from_subaccount = null;
created_at_time = null;
amount = 1_000_000_000_000 : nat;
},
)

Do you want to send this message? [y/N]
y
(variant { Ok = 0 : nat })

Which ledger implementation do you use? Or which link do you use to download the wasm?

My suspicion is that you are using an impl that uses u64 to store the token amount. In one of the impls that I saw if the amount is larger than the max the impl supports then the call gets rejected with insufficient funds,

From this script:

# ckETH requires special ledger and index to handle 18 decimals, therefore the special wasm
curl -sSL https://download.dfinity.systems/ic/$IC_COMMIT/canisters/ic-icrc1-ledger-u256.wasm.gz -o "$DIR"/cketh_ledger.wasm.gz
gunzip "$DIR"/cketh_ledger.wasm.gz

I agree with you,because during initialization, I discovered that if the pre_minter_token in the initialization parameter is set to exceed u64 max, an error will be reported, but the parameter type is nat, and nat should be u128, but I have not found any relevant documentation about this problem.

This solved my problem, thank you

1 Like