Empower The IOTA Payment Module with WebAssembly

We try to improve the user experience of the IOTA Payment Module, which runs in the back of the einfachIOTA Magazine shop. I want to use some WebAssembly to reduce the loading time after pressing the “Pay with IOTA” Button.

Three Example Calls

We use the official IOTA javascript library with nodejs. Here are three example requests with the “Pay with IOTA” button. The first value ist for the whole POST request, the value above is just the time, which needs the library for creating a new IOTA address.

POST /api/pay_with_iota 684.710 ms
Time for generateAddress 536 ms

POST /api/pay_with_iota 605.541 milliseconds
Time for generateAddress 582 ms

POST /api/pay_with_iota 200 701.732 ms
Time for generateAddress 592 ms

The blue overlay shows the loading time. It’s huge loading time and not good user experience. We see that generateAddress is the bottleneck here. Let’s see, if we can improve it with WASM!

The official IOTA Rust library has a WASM binding, which can be included separately without the Rust library. It’s packed as a javascript module to handle have a simple import. But currently, we cant use the “createAddress” function — so we need to implement it for ourselves. Also, we use wasm-pack to pack the Rust lib to a Javascript module.

POST /api/pay_with_iota 315.631 ms
Time for generateAddress 180 ms

POST /api/pay_with_iota 295.216 ms
Time for generateAddress 185 milliseconds

POST /api/pay_with_iota 298.396 ms
Time for generateAddress 187 ms

Get real time updates directly on you device, subscribe now.

You might also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

GM! :-) Do you have any questions about IOTA?
AI-generated responses may be inaccurate. Not financial advice.