Ledger canister being built during deploy to IC causing deploy to fail. Should that be happening?

Hey devs: I’m trying to deploy to the IC but the deploy is failing because the ledger canister is being built out and it exceeds the 2MB maximum for canister sizes. I used a local version of the ledger canister when developing, but when the app is deployed to the IC, it should be calling the actual ledger canister on the mainnet so I feel like the ledger canister shouldn’t even be being built as a canister during the deploy. Can anyone confirm this? And if it is the case that the ledger canister shouldn’t be being built during my deploy, how do i get it to stop building the ledger canister when deploying?

1 Like

Hi Jesse, it depends on what you are trying to do. If you are developing a canister that uses the ICP ledger then you shouldn’t deploy the ledger canister on mainnet. You can achieve this by removing the ledger canister from your dfx.json. If instead you want to deploy your own token then you should deploy the ledger canister but probably a different one from the ICP ledger.

A side note to this: you should never build the ledger canister locally unless you plan to change its code. We provide optimised builds that you can use both locally and remotely.

1 Like

Thats news to me. How do I call the test ledger remotely?

There’s some info here on the Rosetta API: Integrate with the Internet Computer ledger :: Internet Computer

Perhaps this is closer to what you’d want to do though:

This is what i currently do for ledger testing. As I understand, this requires I deploy the ledger canister locally to use this method. @mariop is saying I don’t have to deploy locally, and that i can merely call a test ledger canister if I’m interpreting him/her correctly?

I think @mariop is saying 2 things:

  1. People shouldn’t build the ledger canister locally unless they want to change the source code, and should use one of the pre-built versions instead
  2. People shouldn’t be deploying the ledger canister to the IC if they want to use the ICP ledger.

I’m not sure of the best way to keep the configuration around for development and then omitting it for production.

@Jesse, I believe this article might be helpful. It details how to run a local ledger without having to build it yourself (pre-built wasm files).

Regarding your development & deployment pains, it would really help if you could include what you are trying to achieve, what tutorials / docs are you following, what does your dfx.json look like, and so on. The IC ecosystem is moving along at neck-breaking speed, and unfortunately some resources are left behind in terms of updating. If you link the versions that you’re following people will have a much easier time understanding where you got stuck, and helping you if they can.

Also, consider hopping on the dev discord, there’s a bunch of people hanging out there, you can usually get some quick help / pointers there as well.

2 Likes

If you do solve this on Discord please also update this thread :pray::slightly_smiling_face:

1 Like

Fair point, but on the other hand @Jesse has said in another post that they’ve spent hundreds of dollars on failed deployments. Surely someone on discord can help by catching the problem sooner :slight_smile:

I feel like there’s a time and place for both platforms, and rapid prototyping / figuring out deployment pains in a particular case can benefit from live chats. It’s a great suggestion though to ask people to quickly post something on the forums once they figured it out, maybe someone else can benefit from their pains later on.

1 Like

The issue was that I still had
"ledger": { "type": "custom", "wasm": "ledger.wasm", "candid": "ledger.public.did" },
defined in the dfx.json file. Removing it fixed the error.

2 Likes