HomePhabricator

[ecash-lib] Add ecash-lib-wasm, a WebAssembly module for ecash-lib

Description

[ecash-lib] Add ecash-lib-wasm, a WebAssembly module for ecash-lib

Summary:
Builds a WebAssemby module using Rust for secp256k1 and hashing functions.

This currently uses https://github.com/raipay/secp256k1-abc to get libsecp256k1 to compile to WebAssembly using Rust, but in the future we could use the secp256k1 library within the monorepo to get rid of that external dependency.

ecash-lib in the repo now won't typecheck until the WebAssembly is built, but it seems better to not commit compiled binaries than users having to have to build the .wasm file.

In the future, we might want to check the hash of the built wasm file so we get a deterministic build, maybe even provide a signature like we do for the release of bitcoind.

The wasm can be built using either dockerbuild.sh or build-wasm.sh, the former just requires docker, the latter requires some wasm toolchains to be installed.

Test Plan:

  1. cd ecash-lib-wasm && ./dockerbuild.sh
  2. cd ../ecash-lib && npm run test

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D15931

Details

Provenance
tobias_ruckAuthored on Apr 10 2024, 15:24
tobias_ruckPushed on Apr 10 2024, 19:25
Reviewer
Restricted Project
Differential Revision
D15931: [ecash-lib] Add ecash-lib-wasm, a WebAssembly module for ecash-lib
Parents
rABC6226c274e3be: refactor: Switch serialize to uint8_t
Branches
Unknown
Tags
Unknown