IC method upload_chunk costs

The documentation about the IC method upload_chunk left me with few questions open:

Notably, the following mention:

The storage cost of each chunk is fixed and corresponds to storing 1MiB of data.

What does this mean? If I upload the maximum of 100 chunks of 1MB, do I pay for 1MB or 100MB?
How much does it actually cost?
Are the chunks available forever? Are they ever cleared, or do I need to pay indefinitely?
When I upload new chunks again, do the previous chunks get overwritten?

The way I read it:

  • every chunk counts as 1 MiB of data, no matter if the chunk is the full 1 MiB or just 3k, so make sure you make the chunks as large as possible
  • standard storage fees apply
  • chunks stay available until you call clear_chunk_store
    and you keep paying while they are stored
  • new chunks don’t overwrite old ones
1 Like

Thanks, your summary is much clearer than the documentation :wink:.

It seems like using this approach for a wasm module < 2MB could potentially cost quite a bit more than a standard installation. In dfx, did you implement this method for all installations, or do you check the size of the Wasm module to only use it when necessary?

dfx only chunks when necessary

1 Like