IC management create canister type "asset"

An “asset canister” actually is just another canister to the IC; it’s an abstraction that lives solely on the dfx side.

Here’s the source for the asset canister. Since it’s written in Rust, you would need to compile the canister to wasm, hardcode those wasm bytes into the rust canister code that is dynamically creating new canisters, and then have it call the IC management canister with those bytes as a parameter. (See this comment.)

It’s really a complete pain… In Motoko, it’s much simpler and you don’t need to worry about hardcoding any bytes (since the compiler does it for you). I’m in a similar boat where I want to dynamically spin up asset canisters when existing ones fill up, and I was hoping to have the “controller” canister be written in Motoko but I don’t think I can directly call the IC management canister with byte literals in Motoko…

There’s an awesome project I found out about today that’s porting over the Rust assets canister code into Motoko, which would be huge for this use case. It’s not complete though.

2 Likes