# Exceeded the instruction limit for single message execution

**URL:** <https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731>\
**Category:** Developers\
**Tags:** TypeScript\
**Created:** [April 16, 2024, 9:38am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731 "2024-04-16T09:38:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 16, 2024, 9:38am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/1 "2024-04-16T09:38:41Z")

</div>

I got

> Exceeded the instruction limit for single message execution

when call this code. Is this normal?

```auto
const mnemonic = 'unit jelly zone token virus blue parrot pottery stage girl version grief left black foam donkey fatigue silly bitter fox manage note indoor leisure'
const seed = bip39.mnemonicToSeedSync(mnemonic)

```

---

<div class="post-metadata">

**Author:** ![domwoe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/domwoe/32/5165_2.png) [@domwoe](https://forum.dfinity.org/u/domwoe)\
**Post date:** [April 16, 2024, 11:09am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/2 "2024-04-16T11:09:40Z")

</div>

Is this in the context of an update call or a query call?

Note also that it is probably not a good idea to have this code in a canister as of now, as node provides could have access to your secret.

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [April 16, 2024, 11:09am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/3 "2024-04-16T11:09:42Z")

</div>

What CDK are you using?

Can you show more of the code?

---

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 17, 2024, 3:10am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/4 "2024-04-17T03:10:06Z")

</div>

Thank you for response.  
Note that this is just a demo how to create a KeyPair.  
I want to make an wallet canister. What is best solution for this now?

---

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 17, 2024, 3:12am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/5 "2024-04-17T03:12:16Z")

</div>

I’m using Typescript with azle.  
This is all code of a query function in backend canister.  
The function cause error is `mnemonicToSeedSync `.

---

<div class="post-metadata">

**Author:** ![domwoe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/domwoe/32/5165_2.png) [@domwoe](https://forum.dfinity.org/u/domwoe)\
**Post date:** [April 17, 2024, 7:31am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/6 "2024-04-17T07:31:01Z")

</div>

> [@rainboy93](#):
>
> This is all code of a query function in backend canister.

Query calls have a low instruction limit on purpose because the IC doesn’t charge for them yet.  
Azle also adds quite a bit of overhead. Calling a similar function in Motoko or Rust would probably work.

You can change your function to an update call to have a higher instruction limit for a single message execution.

You can always review the current limits on the IC in the docs: [Resource limits | Internet Computer](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/resource-limits#resource-constraints-and-limits).

---

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 17, 2024, 7:54am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/7 "2024-04-17T07:54:01Z")

</div>

Thank you very much.  
Would you mind to suggest any related bip39 stuff in Motoko?

---

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 17, 2024, 8:16am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/8 "2024-04-17T08:16:37Z")

</div>

Seem that change query to update is not working.  
The error still persist.

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [April 17, 2024, 11:43am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/9 "2024-04-17T11:43:27Z")

</div>

Can you try running it inside of init or post upgrade? Currently Azle’s crypto functionality is mostly implemented in JavaScript, and some operations can unfortunately use many many cycles. We hope to address this in the coming months.

You might be able to do this in init or post upgrade, since they have a 200 billion instruction limit.

---

<div class="post-metadata">

**Author:** ![rainboy93](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rainboy93](https://forum.dfinity.org/u/rainboy93)\
**Post date:** [April 19, 2024, 2:45am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/10 "2024-04-19T02:45:46Z")

</div>

I am developing a function where user can create their KeyPair.  
So that calling this function in init or post upgrade seem not right.

---

<div class="post-metadata">

**Author:** ![timo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timo/32/5543_2.png) [@timo](https://forum.dfinity.org/u/timo)\
**Post date:** [April 19, 2024, 5:47am UTC](https://forum.dfinity.org/t/exceeded-the-instruction-limit-for-single-message-execution/29731/11 "2024-04-19T05:47:10Z")

</div>

Please note that canister memory, execution and call and response data is not hidden from the node providers. So you should neither generate nor store secret key material in the canister, nor should you transmit secret keys into or out of the canister.

What you can do in your case is to create an asset canister, ie frontend hosted in a canister, which can then generate a key pair client side for the user.
