Empower The IOTA Payment Module with WebAssembly

The full article was originally published by Huhn on Medium. Read the full article here.

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

Read the full Article

The full article was originally published by Huhn on Medium, where people are continuing the conversation by highlighting and responding to this story.

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. AcceptRead More

Did you know?

Buy in without the stress of trying to time the market

when you setup a savings plan. If you haven’t started a plan yet, head to your Bitpanda account to get started!

Purchasing cryptocurrencies comes with a number of risks.
Never invest money that you can't afford to lose.

You can automatically invest

in IOTA with Bitpanda Savings!