# Wasm compile with ic\_bls12\_381

**URL:** https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816
**Category:** Rust
**Created:** [March 3, 2025, 8:03am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816 "2025-03-03T08:03:01Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![StewartYe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stewartye/32/23686_2.png) [@StewartYe](https://forum.dfinity.org/u/StewartYe)
#### Post date: [March 3, 2025, 8:03am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/1 "2025-03-03T08:03:01Z")

</div>

hello everyone , I’m developing ethereum lightclient on ICP， I need verify the signature of ethereum commutee on consensus. so I import the ic\_bls12\_381 for it. then I can compile the canister . but when i extract the did file, I got a error:  
Error: unknown import: ` __wbindgen_placeholder__ ::__wbindgen_describe` has not been defined

How can I fix it?

---

<div class="post-metadata">

### Author: ![baolongt](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@baolongt](https://forum.dfinity.org/u/baolongt)
#### Post date: [March 3, 2025, 8:13am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/2 "2025-03-03T08:13:49Z")

</div>

Normally this happened because one of the dependencies not support in canister runtime

---

<div class="post-metadata">

### Author: ![StewartYe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stewartye/32/23686_2.png) [@StewartYe](https://forum.dfinity.org/u/StewartYe)
#### Post date: [March 3, 2025, 8:21am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/3 "2025-03-03T08:21:47Z")

</div>

but the package is developed by dfinity for canister

---

<div class="post-metadata">

### Author: ![baolongt](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@baolongt](https://forum.dfinity.org/u/baolongt)
#### Post date: [March 3, 2025, 8:35am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/4 "2025-03-03T08:35:06Z")

</div>

I don’t mean this package, it can be another one.

---

<div class="post-metadata">

### Author: ![StewartYe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stewartye/32/23686_2.png) [@StewartYe](https://forum.dfinity.org/u/StewartYe)
#### Post date: [March 3, 2025, 8:54am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/5 "2025-03-03T08:54:23Z")

</div>

but when I don’t import ic\_bls12\_381, all things is ok.

---

<div class="post-metadata">

### Author: ![JackLloyd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jacklloyd/32/9649_2.png) [@JackLloyd](https://forum.dfinity.org/u/JackLloyd)
#### Post date: [March 3, 2025, 2:33pm UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/6 "2025-03-03T14:33:24Z")

</div>

The `ic_bls12_381` canister was created for use within the IC replicas, we (at least on the cryptography team) have not tested it in canisters at all. The crate is pure Rust so I’m not sure what the problem might be in terms of compiling it for webassembly.

---

<div class="post-metadata">

### Author: ![JackLloyd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jacklloyd/32/9649_2.png) [@JackLloyd](https://forum.dfinity.org/u/JackLloyd)
#### Post date: [March 3, 2025, 3:06pm UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/7 "2025-03-03T15:06:23Z")

</div>

I was reminded that we do use `ic_bls12_381` in a couple of canisters such as [VetKD API mock canister](https://github.com/dfinity/examples/tree/master/rust/vetkd/src/system_api), without any apparent problems. Can you post some kind of minimal example that replicates the problem you’re seeing?

---

<div class="post-metadata">

### Author: ![StewartYe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stewartye/32/23686_2.png) [@StewartYe](https://forum.dfinity.org/u/StewartYe)
#### Post date: [March 9, 2025, 8:50am UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/8 "2025-03-09T08:50:13Z")

</div>

when I import this:  
use ic\_bls12\_381::{  
hash\_to\_curve::{ExpandMsgXmd, HashToCurve},  
multi\_miller\_loop, G1Affine, G1Projective, G2Affine, G2Prepared, G2Projective, Gt, Scalar,  
};  
I got the error above

---

<div class="post-metadata">

### Author: ![JackLloyd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jacklloyd/32/9649_2.png) [@JackLloyd](https://forum.dfinity.org/u/JackLloyd)
#### Post date: [March 14, 2025, 1:31pm UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/10 "2025-03-14T13:31:44Z")

</div>

> [@StewartYe](#):
>
> use ic\_bls12\_381::{  
> hash\_to\_curve::{ExpandMsgXmd, HashToCurve},  
> multi\_miller\_loop, G1Affine, G1Projective, G2Affine, G2Prepared, G2Projective, Gt, Scalar,  
> };

Here is an example canister which has similar imports

> **[GitHub - randombit/test-bls12-384-wasm32](https://github.com/randombit/test-bls12-384-wasm32)**
>
> Contribute to randombit/test-bls12-384-wasm32 development by creating an account on GitHub.

This compiles without issue, so I imagine there is something else going on. I would need more details, ideally a repository with a full reproducing testcase, in order to assist.

---

<div class="post-metadata">

### Author: ![lwshang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lwshang/32/3394_2.png) [@lwshang](https://forum.dfinity.org/u/lwshang)
#### Post date: [March 20, 2025, 4:16pm UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/11 "2025-03-20T16:16:07Z")

</div>

It’s probably that `ic_bls12_381` has some optional dependency that depends on the `getrandom` crate.  
In the example canister from Jack above, the crate only turns on the `experimental` [feature](https://github.com/randombit/test-bls12-384-wasm32/blob/61becd792bcf2acecd6c758223ada5ae154cfc5a/src/test-bls-canister-backend/Cargo.toml#L15) instead of turning on all default features.  
Could you try if you can do the same thing in your project?

If the `getrandom` dependency is inevitable, you can try the solution [here](https://forum.dfinity.org/t/module-imports-function-wbindgen-describe-from-wbindgen-placeholder-that-is-not-exported-by-the-runtime/11545/8).

---

<div class="post-metadata">

### Author: ![sat](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/sat/32/816_2.png) [@sat](https://forum.dfinity.org/u/sat)
#### Post date: [March 20, 2025, 4:24pm UTC](https://forum.dfinity.org/t/wasm-compile-with-ic-bls12-381/41816/12 "2025-03-20T16:24:25Z")

</div>

@StewartYe I believe we identified the issue and that it should be resolved once [Work around a Rust/LLVM issue affecting wasm32 targets by randombit · Pull Request #17 · dfinity/bls12\_381 · GitHub](https://github.com/dfinity/bls12_381/pull/17) is rolled out through the new crate versions.  
You can also try to apply the same change in your project (via `[patch]` or in some other way) and report if it worked for you.
