taurushq-io / multi-party-sig

Implementation of protocols for threshold signatures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docs: how to run in web assembly

davidp94 opened this issue · comments

commented

Is this project wasm compatible?

I was able to get the example to run in a browser, using this compile command

GOOS=js GOARCH=wasm go build -o main.wasm -tags math_big_pure_go *.go

But wow is it slow. On my i9 MacBook Pro the example took about 10min to complete. Best to run it in a worker to get it off the main thread. Obviously it would be faster if each party was running in its own thread, but that is an experiment for another day.

Thank you @johnthethird for reporting these results! The example was designed to show the user how the library can be implemented, and as you mentioned, does not reflect a real world scenario.

Unfortunately, I've never experimented with WASM before, so it might be a while before we start officially supporting it. But as we continue to optimize the code, things should get faster in the WASM world as well.

I think one issue that definitely needs investigating is the use of specialized assembly for safenum. Since modular exponentiations of safenum.Nat is currently one of the main bottlenecks, this might be an easy way of speeding things up.