{"id":14980206,"url":"https://github.com/bwt-dev/libbwt-nodejs","last_synced_at":"2025-07-02T07:04:25.494Z","repository":{"id":117492582,"uuid":"325466524","full_name":"bwt-dev/libbwt-nodejs","owner":"bwt-dev","description":"JavaScript bindings for Bitcoin Wallet Tracker, a lightweight personal indexer for bitcoin wallets","archived":false,"fork":false,"pushed_at":"2021-03-25T00:56:57.000Z","size":72,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T21:51:44.576Z","etag":null,"topics":["bitcoin","bitcoin-wallet-tracker","bwt","nodejs"],"latest_commit_sha":null,"homepage":"https://bwt.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwt-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://btcpay.shesek.info/"]}},"created_at":"2020-12-30T05:48:46.000Z","updated_at":"2024-04-07T06:14:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea824a21-fe9a-47aa-859a-64df9cbca0df","html_url":"https://github.com/bwt-dev/libbwt-nodejs","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"6f00376f62d341b688416143993f0ee0e6cb9ed8"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bwt-dev/libbwt-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwt-dev%2Flibbwt-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwt-dev%2Flibbwt-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwt-dev%2Flibbwt-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwt-dev%2Flibbwt-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwt-dev","download_url":"https://codeload.github.com/bwt-dev/libbwt-nodejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwt-dev%2Flibbwt-nodejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263091026,"owners_count":23412343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoin-wallet-tracker","bwt","nodejs"],"created_at":"2024-09-24T14:01:26.837Z","updated_at":"2025-07-02T07:04:25.470Z","avatar_url":"https://github.com/bwt-dev.png","language":"JavaScript","funding_links":["https://btcpay.shesek.info/"],"categories":[],"sub_categories":[],"readme":"# Bitcoin Wallet Tracker - JavaScript bindings\n\n[![Build Status](https://travis-ci.org/bwt-dev/libbwt-nodejs.svg?branch=master)](https://travis-ci.org/bwt-dev/libbwt-nodejs)\n[![NPM release](https://img.shields.io/npm/v/libbwt.svg)](https://www.npmjs.com/package/libbwt)\n[![NPM installs](https://img.shields.io/npm/dt/libbwt?label=npm%20installs)](https://www.npmjs.com/package/libbwt)\n[![Downloads](https://img.shields.io/github/downloads/bwt-dev/libbwt-nodejs/total.svg?color=blueviolet)](https://github.com/bwt-dev/libbwt-nodejs/releases)\n[![MIT license](https://img.shields.io/github/license/bwt-dev/libbwt-nodejs.svg?color=yellow)](https://github.com/bwt-dev/libbwt-nodejs/blob/master/LICENSE)\n[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/bwt-dev/bwt#developing)\n\nJavaScript bindings for [Bitcoin Wallet Tracker](https://github.com/bwt-dev/bwt), a lightweight personal indexer for bitcoin wallets.\n\n`libbwt-nodejs` allows to programmatically manage bwt's Electrum RPC and HTTP API servers.\nIt can be used as a compatibility layer for easily upgrading Electrum-backed wallets to support a\nBitcoin Core full node backend (by running the Electrum server *in* the wallet),\nor for shipping software that integrates bwt's [HTTP API](https://github.com/bwt-dev/bwt#http-api)\nas an all-in-one package.\n\nIt is based on the [`libbwt` C FFI](https://github.com/bwt-dev/libbwt).\n\nSupport development: [⛓️ on-chain or ⚡ lightning via BTCPay](https://btcpay.shesek.info/)\n\n- [Usage](#usage)\n- [Installation](#installation)\n  - [Electrum only](#electrum-only-variant)\n  - [Verifying the signature](#verifying-the-signature)\n- [Building from source](#building-from-source)\n- [Reproducible builds](#reproducible-builds)\n- [License](#license)\n\n\u003e Also see: [bwt](https://github.com/bwt-dev/bwt), [libbwt](https://github.com/bwt-dev/libbwt) and [libbwt-jni](https://github.com/bwt-dev/libbwt-jni).\n\n## Usage\n\nBelow is a minimally viable setup. If bitcoind is running locally on the default port, at the default datadir location\nand with cookie auth enabled (the default), this should Just Work™ \\o/\n\n```js\nimport { BwtDaemon } from 'libbwt'\n\nconst bwtd = await BwtDaemon({\n  xpubs: [ 'xpub66...' ],\n  electrum: true,\n}).start()\n\nconsole.log('bwt electrum server ready on', bwtd.electrum_addr)\n```\n\nWith some more advanced options:\n\n```js\nconst bwtd = await BwtDaemon({\n  // Network and Bitcoin Core RPC settings\n  network: 'regtest',\n  bitcoind_dir: '/home/satoshi/.bitcoin',\n  bitcoind_url: 'http://127.0.0.1:9008/',\n  bitcoind_wallet: 'bwt',\n\n  // Descriptors and xpubs to track\n  descriptors: [ 'wpkh(tpub61.../0/*)' ],\n  xpubs: [ 'tpub66...' ],\n\n  // Rescan since timestamp. Accepts unix timestamps, date strings, Date objects, or 'now' to look for new transactions only\n  rescan_since: '2020-01-01',\n\n  // Enable HTTP and Electrum servers (use port 0 to bind on any available port)\n  electrum_addr: '127.0.0.1:0',\n  http_addr: '127.0.0.1:0',\n\n  // Set the gap limit of watched unused addresses\n  gap_limit: 100,\n\n  // Progress notifications for initial block download and wallet rescanning\n  sync_progress: (progress, tip_time) =\u003e\n    console.log(`Initial block download in progress... (${progress*100}% done, synced up to ${tip_time})`),\n  scan_progress: (progress, eta) =\u003e\n    console.log(`Wallet rescanning in progress... (${progress*100}% done, ETA ${eta} seconds)`),\n}).start()\n\n// Get the assigned address/port for the Electrum/HTTP servers\nconsole.log('bwt electrum server ready on', bwtd.electrum_addr)\nconsole.log('bwt http server ready on', bwtd.http_url)\n\n// Shutdown\nbwtd.shutdown()\n```\n\nSee [`example.js`](example.js) for a more complete example, including connecting to the HTTP API.\n\nThe API servers are unauthenticated by default, but\n[authentication can be enabled](https://github.com/bwt-dev/bwt/blob/master/doc/auth.md).\n\nThe list of options is available in the [libbwt C FFI documentation](https://github.com/bwt-dev/libbwt#config-options).\nThe nodejs wrapper also provides the following additional options:\n\n- `sync_progress` - callback for IBD progress notifications, invoked with `(progress, tip_time)`\n- `scan_progress` - callback for wallet rescan progress notifications, invoked with `(progress, eta)`\n- `electrum` - setting to `true` is an alias for `electrum_addr=127.0.0.1:0`\n- `http` - setting to `true` is an alias for `http_addr=127.0.0.1:0`\n\nNote that if you call `shutdown()` while bitcoind is importing/rescanning addresses, the daemon will\nnot stop immediately but will be marked for later termination.\n\n## Installation\n\nInstall from the npm registry:\n\n```\n$ npm install libbwt\n```\n\n(Instructions for installing the signed package are available below.)\n\nThe will download the `libbwt` library for your platform as a postinstall step.\nThe currently supported platforms are Linux, Mac, Windows and ARMv7/8.\n\nThe hash of the downloaded library is verified against the\n[`SHA256SUMS`](LIBBWT-SHA256SUMS) file that ships with the npm package.\n\n\u003e Note: `libbwt-nodejs` uses [`ffi-napi`](https://github.com/node-ffi-napi/node-ffi-napi), which requires\n\u003e a recent nodejs version. If you're running into errors during installation or segmentation faults,\n\u003e try updating to a newer version, and make sure to install and run libbwt using the same version.\n\n#### Electrum-only variant\n\nTo install libbwt with Electrum support only (without the HTTP API), run `BWT_VARIANT=electrum_only npm install libbwt`.\n\nThe `electrum_only` variant is roughly 33% smaller and comes with less dependencies.\n\n#### Verifying the signature\n\nThe releases are signed by Nadav Ivgi (@shesek).\nThe public key can be verified on\nthe [PGP WoT](http://keys.gnupg.net/pks/lookup?op=vindex\u0026fingerprint=on\u0026search=0x81F6104CD0F150FC),\n[github](https://api.github.com/users/shesek/gpg_keys),\n[twitter](https://twitter.com/shesek),\n[keybase](https://keybase.io/nadav),\n[hacker news](https://news.ycombinator.com/user?id=nadaviv)\nand [this video presentation](https://youtu.be/SXJaN2T3M10?t=4).\n\n```bash\n# Download\n$ wget https://github.com/bwt-dev/libbwt-nodejs/releases/download/v0.2.4/libbwt-nodejs-0.2.4.tgz\n\n# Fetch public key\n$ gpg --keyserver keyserver.ubuntu.com --recv-keys FCF19B67866562F08A43AAD681F6104CD0F150FC\n\n# Verify signature\n$ wget -qO - https://github.com/bwt-dev/libbwt-nodejs/releases/download/v0.2.4/SHA256SUMS.asc \\\n  | gpg --decrypt - | sha256sum -c -\n\n# Install\n$ npm install libbwt-nodejs-0.2.4.tgz\n```\n\nThe signature verification should show `Good signature from \"Nadav Ivgi \u003cnadav@shesek.info\u003e\" ... Primary key fingerprint: FCF1 9B67 ...` and `libbwt-nodejs-0.2.4.tgz: OK`.\n\n## Building from source\n\nBuild the FFI library for your platform(s) as [described here](https://github.com/bwt-dev/libbwt#building-from-source) and\ncopy the `libbwt.so`/`libbwt.dylib`/`bwt.dll` file into the root directory of `libbwt-nodejs`.\n\n## Reproducible builds\n\nThe nodejs package (including the `LIBBWT-SHA256SUMS` file with the `libbwt` hashes for all platforms)\ncan be reproduced in a Docker container environment as follows:\n\n```bash\n$ git clone https://github.com/bwt-dev/libbwt-nodejs \u0026\u0026 cd libbwt-nodejs\n$ git checkout \u003ctag\u003e\n$ git verify-commit HEAD\n$ git submodule update --init --recursive\n\n# Build libbwt FFI library files for Linux, Windows, ARMv7 and ARMv8\n$ docker build -t bwt-builder - \u003c bwt/scripts/builder.Dockerfile\n$ docker run -it --rm -u `id -u` -v `pwd`/libbwt:/usr/src/libbwt -w /usr/src/libbwt \\\n  --entrypoint scripts/build.sh bwt-builder\n\n# Build libbwt FFI library files for Mac OSX (cross-compiled via osxcross)\n$ docker build -t bwt-builder-osx - \u003c bwt/scripts/builder-osx.Dockerfile\n$ docker run -it --rm -u `id -u` -v `pwd`/libbwt:/usr/src/libbwt -w /usr/src/libbwt \\\n  --entrypoint scripts/build.sh bwt-builder-osx\n\n# Build libbwt-nodejs npm package\n$ docker run -it --rm -u `id -u` -v `pwd`:/usr/src/libbwt-nodejs -w /usr/src/libbwt-nodejs \\\n  -e LIBBWT_DIST=/usr/src/libbwt-nodejs/libbwt/dist \\\n  --entrypoint scripts/build.sh node:14\n\n$ sha256sum dist/*.tgz\n```\n\nYou may set `-e TARGETS=...` to a comma separated list of the platforms to build.\nThe available platforms are: `x86_64-linux`, `x86_64-osx`, `x86_64-windows`, `arm32v7-linux` and `arm64v8-linux`.\n\nBoth variants will be built by default. To build the `electrum_only` variant only, set `-e ELECTRUM_ONLY_ONLY=1`.\n\nThe builds are [reproduced on Travis CI](https://travis-ci.org/github/bwt-dev/libbwt-nodejs/branches) using the code from GitHub.\nThe SHA256 checksums are available under the \"Reproducible builds\" stage.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwt-dev%2Flibbwt-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwt-dev%2Flibbwt-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwt-dev%2Flibbwt-nodejs/lists"}