An ultra-lightweight, zero-dependency JavaScript library for Bitcoin, Bitcoin Cash, and Bitauth applications.

starsStars 200
forksForks 27
watchersWatchers 200
current-versionCurrent version
total-releasesTotal releases 0
open_issues_countOpen issues 15
dateFirst release -
dateLatest release -
updateLast update 2020-12-15

Libauth logo

An ultra-lightweight JavaScript library for Bitcoin, Bitcoin Cash, and Bitauth applications.

Explore API Reference »

NPM version Codecov CircleCI GitHub stars


An ultra-lightweight JavaScript library for Bitcoin, Bitcoin Cash, and Bitauth applications.

Libauth has no dependencies and works in all JavaScript environments, including Deno, and browsers.


Libauth is designed to be flexible, lightweight, and easily auditable. Rather than providing a single, overarching, object-oriented API, all functionality is composed from simple functions. This has several benefits:

  • Flexibility – Even highly-complex functionality is built-up from simpler functions. These lower-level functions can be used to experiment, tweak, and remix your own higher-level methods without maintaining a fork of the library.
  • Smaller application bundles – Applications can import only the methods they need, eliminating the unused code (via dead-code elimination).
  • Better auditability – Beyond having no dependencies of its own, Libauth's functional programming approach makes auditing critical code easier: smaller bundles, smaller functions, and less churn between versions (fewer cascading changes to object-oriented interfaces).
  • Fully-portable – No platform-specific APIs are ever used, so the same code paths are used across all JavaScript environments (reducing the auditable "surface area" and simplifying library development).

Getting Started

To get started, install @bitauth/libauth:

npm install @bitauth/libauth
# OR
yarn add @bitauth/libauth

And import the functionality you need:

import { instantiateSecp256k1 } from '@bitauth/libauth';
import { msgHash, pubkey, sig } from './somewhere';

(async () => {
  const secp256k1 = await instantiateSecp256k1();
  secp256k1.verifySignatureDERLowS(sig, pubkey, msgHash)
    ? console.log('🚀 Signature valid')
    : console.log('❌ Signature invalid');

Typescript Types

Note: @bitauth/libauth uses to your tsconfig.json.

Using with Deno

Deno is a great runtime for quickly working with Libauth. You can import from the latest module build:

import { hexToBin } from '';


Stable API

The following APIs are considered stable, and will only include breaking changes in major version upgrades.

WebAssembly ECDSA & Schnorr

WebAssembly Hashing Functions

Unstable APIs

Libauth also exports new, potentially unstable APIs. As these APIs stabilize, they will be included in the above reference.

Full API Documentation →


Pull Requests welcome! Please see for details.

This library requires Node.js installed (which ships with npm), then run npm install -g yarn. Once Yarn is installed:

# use --recursive to clone the secp256k1 submodule
git clone --recursive && cd libauth

Install the development dependencies:


Then try running the test suite:

yarn test

You can also run the benchmarks (this will take a while):

yarn bench

During development, you may find it helpful to use the testing watch tasks:

yarn watch # rebuild everything on save
yarn watch:test # run only the fast tests
yarn watch:test-slow # test everything

For more information about the available package scripts, run:

yarn run info