4 stable releases

2.1.1 Dec 11, 2023
2.1.0 Dec 6, 2023
2.0.2 Oct 19, 2023
2.0.1 Apr 19, 2023
2.0.0 Oct 13, 2022

#1676 in Magic Beans

MIT license

1MB
5K SLoC

BSV.WASM/BSV-RS

A Rust/WASM Library to interact with Bitcoin SV

Installation

NodeJS 14.6+:
npm i bsv-wasm --save

Web:
npm i bsv-wasm-web --save

Webpack:
npm i bsv-wasm-bundler --save

Rust:
https://crates.io/crates/bsv

Deno:

import init, { Transaction } from "https://deno.land/x/bsv_wasm@{VERSION}/bsv_wasm.js"
await init();

Usage

Note: Rust and JS/TS method names and structs are the same

  • Eg. Derive private key from XPriv and log out P2PKH String ExtendedPrivateKey.fromWIF('LMyWif...').toPrivateKey().toPublicKey().toAddress().toString()

Features

  • Hash (SHA256, SHA256d, SHA1, RIPEMD160, Hash160, SHA512)
  • KDF (PBKDF2)
  • Encryption (AES-CBC, AES-CTR)
  • ECDSA (Private Key, Public Key, Signatures)
  • Transaction (Building, Serialising, Deserialising)
  • Script (Serialising, Deserialising)
  • Script Matching (ScriptTemplate)
  • Addresses (P2PKH)
  • Sighash Support
  • Extended Private Keys and Child Derivation (BIP32, BIP42)
  • Testnet support

TODO:

  • Split WASM modules from Rust - Release standalone bsv-rs
  • Break WASM packages up to be more modular
  • Allow Interop between WASM Packages
  • Write documentation (Inline on functions and structs)

Thanks

Dependencies

~7MB
~147K SLoC