I am deploying the ICRC1 ledger and I’m unsure who should be set as the owner in the deployment command. Currently, I’ve been using (dfx identity --identity default get-principal) which assigns the default identity as the owner. However, this requires me to always send tokens from the CLI to the desired principal.
when I try to transfer tokens via the ledger’s Candid UI, I get an “insufficient balance” error because the logged-in principal isn’t the owner and doesn’t hold any tokens. Should the owner be the actual principal on the mainnet, or would it be better to create a backend canister as the owner and manage transfers through it? Who should ideally be assigned as the owner in this case?
Command : dfx deploy icrc1_ledger_canister --argument “(variant {
Init = record {
token_symbol = "ICRC1";
token_name = "L-ICRC1";
minting_account = record {
owner = principal "$(dfx identity --identity DevJour get-principal)"
};
transfer_fee = 10_000;
metadata = vec {
record { "logo_url"; variant { Text = "/j.png" } };
};
initial_balances = vec {
record {
record {
owner = principal "$(dfx ledger account-id)";
};
10_000_000_000;
};
};
archive_options = record {
num_blocks_to_archive = 1000;
trigger_threshold = 2000;
controller_id = principal "$(dfx identity --identity DevJour get-principal)";
};
feature_flags = opt record {
icrc2 = true;
};
}
})”
You can set multiple initial balances, then you can work with multiple options. For a demo project just go with whichever identity is most convenient. For a serious project I would suggest you create a separate canister to be the minting account
It’s a serious project, I want to let users later on exchange ICP with my token, and I don’t know who should hold my token and who should be the owner, so later on that owner can send my token and receive the ICP. So I don’t understand who will be the owner of the token, and for the minting account who also should be the minter and If the minter is a new canister that I will make so what should I put in this canister plus who to mint new tokens from it?
As @Severin pointed out, there are multiple options.
The minting account has the authority to mint tokens as the name suggests. If there is a fixed amount of your token at genesis and no token should ever be minted, then there is no need to specify a minting account.
The cycles ledger, which mints tokens whenever it receives cycles, also does not specify a minting account because it simply mints tokens itself (it is the ledger canister, so it can do whatever it wants with the balances).
By contrast, the ckBTC ledger specifies the ckBTC minter’s (default) account as the minting account, so a separate minting canister is used in this architecture.
It is really up to you which approach you want to follow. If your minting logic is very simple, you might prefer to just add the logic to the ledger (and then you don’t need a minting account). On the other hand, if the minting and burning flows are somewhat complex, it may be preferable to use a standard ICRC ledger and have the minting and burning logic in a separate canister.