Use pre-compiled WASM files with optional optimization and metadata injection.
Example of how to reference this recipe in an icp.yaml file:
canister:
name: my-canister
recipe:
type: "@dfinity/pre-built"
configuration:
path: dist/canister.wasm
sha256: 17a05e36278cd04c7ae6d3d3226c136267b9df7525a0657521405e22ec96be7a
shrink: true
compress: false
metadata:
- name: "custom:version"
value: "1.0.0"| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
| path | string | Yes | Local path to the pre-built WASM file | - |
| sha256 | string | No | SHA256 hash for integrity verification | - |
| metadata | array | No | Array of key-value pairs for custom metadata | [] |
ic-wasmtool must be installed for metadata injection and optimization- Pre-compiled WASM file must exist at the specified path
- SHA256 hash must be provided for integrity verification
canister:
name: simple-canister
recipe:
type: "@dfinity/pre-built"
configuration:
path: target/wasm32-unknown-unknown/release/my_canister.wasm
sha256: abc123def456...canister:
name: optimized-canister
recipe:
type: "@dfinity/pre-built"
configuration:
path: dist/production-canister.wasm
sha256: xyz789abc123...
metadata:
- name: "build:version"
value: "2.1.0"
- name: "build:environment"
value: "production"
- name: "build:timestamp"
value: "2024-01-01T00:00:00Z"When this recipe is executed:
- Copies the pre-built WASM file to the output location
- Verifies file integrity using the provided SHA256 hash
- Injects template type metadata ("template:type" = "pre-built")
- Injects any custom metadata specified in the configuration
Problem: SHA256 hash mismatch error
Solution: Verify the WASM file hasn't been modified and regenerate the hash using sha256sum your-file.wasm
Problem: ic-wasm command not found
Solution: Install the IC WASM tool following the instructions at https://github.com/dfinity/ic-wasm
Problem: WASM file not found at specified path Solution: Verify the path is correct relative to your project root and the file exists
- Rust Recipe - For building Rust canisters from source
- Motoko Recipe - For building Motoko canisters from source
- Assets Recipe - For the official IC assets canister
Use this recipe when you have a pre-compiled WASM file and want to add metadata or optimize it without rebuilding from source.
- v1.0.0 - Initial release with basic pre-built WASM support