Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bsv-wasm-bundler

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsv-wasm-bundler

A Bitcoin SV library with WASM in mind.

  • 1.3.0-beta.3
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

BSV.WASM

A Rust/WASM Library to interact with Bitcoin SV

Installation

NodeJS:
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-wasm

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()

Caveats

  • IMPORTANT: Call .free() on every WASM object after you are done with it to prevent memory leaks and slowdown. This is required because WASM->JS interaction doesnt have garbage collection implemented for it. When the Javascript object goes out of scope, it will free the pointer to the WASM object but never free the memory allocated by the WASM runtime.
  • Bitcoin Signed Message (BSM) struct does not implement any base64 string parsing, please pass the raw Signature type or call fromCompactBytes on the Signature struct and pass it to the BSM.verify function.

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)
  • Addresses (P2PKH)
  • Sighash Support
  • Extended Private Keys and Child Derivation (BIP32, BIP42)

TODO:

  • Script Builder
  • Isomorphic Package for JS
  • Write documentation (Inline on functions and structs)
  • Testnet Support

Will not do:

  • Mnemonics

Thanks

FAQs

Package last updated on 07 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc