iota.js
iota.js copied to clipboard
[Task]: Improve LocalPowProvider or refactor WasmPowProvider for browsers
Description
The LocalPowProvider is currently too slow and Milestones will pass while it computes the Pow. This makes it impossible to send valid transactions in browsers.
We could make use of the WasmPowProvider, but this needs some refactoring as the current library makes use of Node.js functionality (worker_threads, os, path).
I've already tried to port it for browsers. The wasm binary gets executed, but does not seem to ever end. So further investigation is needed.
Otherwise, maybe there is a way to speed up the LocalPowProvider by moving the computation into multiple WebWorkers? It most likely could be setup like the WasmPowProvider does this with the wasm context.
https://github.com/iotaledger/iota.js/issues/949 should take care of this part Milestones will pass while it computes the Pow
, but of course would also be good if the speed can be increased, not sure how much is possible there
- Moved powHelper util from iota to crypto package to optimise dependencies
- Added a pow-browser that supplies a BrowserPowProvider to perform PoW in a browser env leveraging WebWorkers
- iota.js doesn't supply a IPowProvider implementation out of the box anymore! You need to import one of the "pow" packages suitable for your case.
- Added powInterval and maxPowAttempts optional parameters for iota.js highlevel submitBlock
- powInterval defines in seconds how long to try doing PoW before refreshing the tips
- maxPowAttempts defines how many attempts to repeat the process for
- Added logic to refresh the block with new parent tips during PoW