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.

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

Trade IOTA with a free

$100,000 practice account

This ad promotes virtual cryptocurrency investing within the EU (by eToro Europe Ltd. and eToro UK Ltd.) & USA (by eToro USA LLC); which is highly volatile, unregulated in most EU countries, no EU protections & not supervised by the EU regulatory framework. Investments are subject to market risk, including the loss of principal.