sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Make installing ledger locally simple

Open roman-kashitsyn opened this issue 3 years ago • 5 comments

Currently, installing the ledger canister locally is a long and complicated procedure: https://github.com/dfinity/ic/tree/a65a3624d504f870f9924f9467dcad9538a85d85/rs/rosetta-api/ledger_canister#deploying-locally

This is too high of a barrier for smart contract developers. Installing the ledger locally should be as easy as

dfx ledger install --minting-account <acc>

The install should happen in such a way that dfx ledger balance and dfx ledger transfer can work with the local instance.

roman-kashitsyn avatar Jan 14 '22 09:01 roman-kashitsyn

Same for II canister. Either we treat these canisters specially or design a general way to work with external canisters.

chenyan-dfinity avatar Jan 14 '22 21:01 chenyan-dfinity

Same for II canister. Either we treat these canisters specially or design a general way to work with external canisters.

Ledger, CMC, Governance, and II have to be treated specially because they are all tied together. E.g., CMC hardcodes the canister id of the Ledger and the Governance. To install these canisters properly, we need to follow a strict init procedure. For everything else, we might develop a more general and scalable approach.

How I'd implement ledger/CMC/Governance/II setup: DFX creates a bunch of canisters (~10) when it first starts the local replica to make sure that first IDs won't be taken by the user canisters. When we issue dfx ledger install or dfx install-system-canister ledger or whatever the command will be, we invoke install_code on the preallocated canister id that the Ledger has on the mainnet.

roman-kashitsyn avatar Jan 14 '22 21:01 roman-kashitsyn

I'd like to register as an interested party. For nns-dapp we have a script to install the governance canisters, Internet Identity and now also SNS canisters. I get requests to replicate this setup for other projects and I suspect that this would be of use to external parties as well. I'd be interested in making such a tool available for general consumption, not necessarily in its current form. E.g. creating a dozen canisters right at the beginning makes a lot of sense in the general case; we don't need that but in a general form it would be good. The common SNS canisters, that live on the NNS and are used by all SNS instances, might be challenging unless they end up being allocated to low canister IDs in production.

bitdivine avatar Jun 10 '22 09:06 bitdivine

I would like to volunteer to implement dfx start --with-nns which would be like dfx start --clean but that installs the nns canisters after starting. This would have to be approved by the sdk team, of course.

The nns canisters include the ledger (requested by @roman-kashitsyn ).

bitdivine avatar Jul 29 '22 09:07 bitdivine

After discussing with the team: Yes, please, @bitdivine, that would be wonderful! I'll reach out to you so we can discuss some implementation details; we have some suggestions for that.

sesi200 avatar Aug 02 '22 17:08 sesi200