MCPcopy Index your code
hub / github.com/Firaenix/bsv-wasm

github.com/Firaenix/bsv-wasm @2.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.1.1 ↗ · + Follow
2,080 symbols 4,637 edges 110 files 712 documented · 34% updated 2y ago2.1.1 · 2023-12-11★ 7113 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

ReversibleDigest (Interface)
(no doc) [3 implementers]
src/hash/reverse_digest.rs
VarIntReader (Interface)
(no doc) [3 implementers]
src/traits/varint.rs
ScriptStack (Interface)
(no doc) [1 implementers]
src/interpreter/stack_trait.rs
InitOutput (Interface)
(no doc)
packages/bsv-wasm/pkg/deno/bsv_wasm.d.ts
HashDigest (Interface)
(no doc) [1 implementers]
src/hash/digest_utils.rs
VarIntWriter (Interface)
(no doc) [2 implementers]
src/traits/varint.rs
ToHex (Interface)
(no doc) [2 implementers]
src/traits/to_hex.rs

Core symbols most depended-on inside this repo

getInt32Memory0
called by 517
examples/webpack-test/sdk/twetch_sdk_wasm_bg.js
getInt32Memory0
called by 443
packages/bsv-wasm/pkg/deno/bsv_wasm.js
takeObject
called by 131
examples/webpack-test/sdk/twetch_sdk_wasm_bg.js
takeObject
called by 121
packages/bsv-wasm/pkg/deno/bsv_wasm.js
getObject
called by 78
examples/webpack-test/sdk/twetch_sdk_wasm_bg.js
from
called by 75
packages/bsv-wasm/src/kdf.rs
_assertClass
called by 72
examples/webpack-test/sdk/twetch_sdk_wasm_bg.js
passArray8ToWasm0
called by 70
examples/webpack-test/sdk/twetch_sdk_wasm_bg.js

Shape

Method 1,410
Class 322
Function 307
Enum 34
Interface 7

Languages

TypeScript54%
Rust46%

Modules by API surface

examples/webpack-test/sdk/twetch_sdk_wasm_bg.js609 symbols
packages/bsv-wasm/pkg/deno/bsv_wasm.js373 symbols
examples/webpack-test/sdk/twetch_sdk_wasm.d.ts93 symbols
packages/bsv-wasm/pkg/deno/bsv_wasm.d.ts55 symbols
src/transaction/mod.rs54 symbols
packages/bsv-wasm/src/transaction/mod.rs46 symbols
src/transaction/txin.rs45 symbols
packages/bsv-wasm/src/transaction/txin.rs35 symbols
tests/script.rs31 symbols
src/script/mod.rs29 symbols
src/transaction/sighash.rs26 symbols
src/keypair/public_key.rs26 symbols

For agents

$ claude mcp add bsv-wasm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact