0.0.0 • Published 1 year ago

bdk v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

node-bdk

EXPERIMENTAL. DO NOT USE.

Use natively compiled BDK in a nodejs context with TypeScript typings. Extremely experimental. Uses https://napi.rs/ to generate bindings.

Inspired by bdk-nodejs and a week at Bitcoin Park.

Supported features

  • Create a wallet
  • Sync to Electrum
  • Get balance

Example

import { ElectrumBlockchain, Wallet, Network } from 'bdk';

const wallet = new Wallet(
  'wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)',
  'wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)',
  Network.Testnet,
);

const chain = new ElectrumBlockchain('ssl://electrum.blockstream.info:60002');
wallet.sync(chain);

const balance: bigint = wallet.getBalance();
console.log('balance', balance); // 5748838n