# How do I pass a canister wasm built using dfx as an argument to another canister call?

**URL:** <https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411>\
**Category:** Command Line Tools\
**Created:** [August 27, 2023, 12:59pm UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411 "2023-08-27T12:59:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [August 27, 2023, 12:59pm UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411/1 "2023-08-27T12:59:37Z")

</div>

I am trying to take the build output of a `dfx build` step which is a canister wasm file and trying to pass it as an argument to another canister via `dfx canister call`.

I imagine it has to be the `blob` type as documented [here](https://internetcomputer.org/docs/current/references/candid-ref#type-blob) since I’m accepting `Vec<u8>` on the Rust parameter side.

Thoughts on how I would achieve this? What would the `dfx canister call` look like?

---

<div class="post-metadata">

**Author:** ![frederikrothenberger](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/frederikrothenberger/32/3826_2.png) [@frederikrothenberger](https://forum.dfinity.org/u/frederikrothenberger)\
**Post date:** [August 28, 2023, 8:00am UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411/2 "2023-08-28T08:00:50Z")

</div>

Hi @saikatdas0790

We have a script for that in Internet Identity, because it is indeed quite cumbersome to do manually. See here: [https://github.com/dfinity/internet-identity/blob/6c80aa0e30162d1aa09fb7348cbd6e4469cd1836/scripts/deploy-archive#L96](https://github.com/dfinity/internet-identity/blob/6c80aa0e30162d1aa09fb7348cbd6e4469cd1836/scripts/deploy-archive#L96)

You have to read the wasm as binary, hex encode it and then add `\` before hex encoded every byte and give that to `dfx` as a string…

I have a ticket open with the SDK team, to make this more convenient out of the box.

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [August 28, 2023, 12:17pm UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411/3 "2023-08-28T12:17:16Z")

</div>

Hi @frederikrothenberger,

Quick follow up question. Do you know of an easy way to generate the hash of the wasm on the command line?

My end game with this is to query the `dfx canister info` and get the running canister wasm and then compare that with the wasm that I’m passing in. If it’s the same, i would pass in null but if they don’t match, then I’ll pass the wasm in.

An additional thing to note is I intend to pass the gzipped wasm as an argument. Would that the file that needs to be hashed for comparision or is it the bare wasm. I want to be able to get back the same hash that’s installed in the target canister

Thoughts on how I would achieve this?

---

<div class="post-metadata">

**Author:** ![frederikrothenberger](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/frederikrothenberger/32/3826_2.png) [@frederikrothenberger](https://forum.dfinity.org/u/frederikrothenberger)\
**Post date:** [August 28, 2023, 12:32pm UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411/4 "2023-08-28T12:32:49Z")

</div>

Hi @saikatdas0790

We usually do something like `sha256="$(shasum -a 256 ./internet_identity.wasm.gz | cut -d ' ' -f1)"`.

A running canister will have as a module hash the hash of the thing that was uploaded, i.e. if you deployed a bare `.wasm` then it will be the hash of that `.wasm` file, if you uploaded a `.wasm.gz` file then it will be the hash of `.wasm.gz` (and _not_ the unpacked wasm).  
So yeah, comparing hashes should work fine.

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [August 28, 2023, 12:34pm UTC](https://forum.dfinity.org/t/how-do-i-pass-a-canister-wasm-built-using-dfx-as-an-argument-to-another-canister-call/22411/5 "2023-08-28T12:34:42Z")

</div>

Perfect. Thank you

20 characters
