npm.io
0.27.0-beta.0 • Published 3d ago

@bitcoin-computer/nakamotojs

Licence
MIT
Version
0.27.0-beta.0
Deps
7
Size
230 kB
Vulns
0
Weekly
0
Stars
45

NakamotoJS

A fork of BitcoinJS tailored towards advanced applications like swaps

Github CI NPM code style: prettier

This fork makes the following changes to BitcoinJS:

  • Works in the browser
  • Supports Litecoin in addition to Bitcoin (support for Dogecoin coming soon)
  • Adds support for signing transactions (BitcoinJS can only sign PSBTs).
  • Adds support for updating inputs and outputs
  • Adds support for serializing and deserializing transactions

Why

While PSBTs are a great for serialization, they are restrictive as they cannot be modified after the first signature is added. This is an issue for applications like swaps where multiple users need to build a transaction collaboratively. In these cases users can take advantage of SIGHASH types that allow the modifications of part of a transaction after a signature is added.

You can find more information on building swap transactions and sale transactions in our docs.

Installation

Install the Bitcoin Computer Monorepo. Then navigate from the root folder of the monorepo to the folder packages/explorer.

# Download the monorepo
git clone https://github.com/bitcoin-computer/monorepo.git

# Move to the package
cd monorepo

# Install the dependencies
npm install

Usage

The following commands can be run from the folder packages/nakamotojs/

Run the Tests
npm run test
Run the Linter
npm run lint
Build the Sources
npm run build

BitcoinJS Docs

See here.

Examples

The below examples are implemented as integration tests, they should be very easy to understand. Otherwise, pull requests are appreciated. Some examples interact (via HTTPS) with a 3rd Party Blockchain Provider (3PBP). 17:29

If you have a use case that you feel could be listed here, please ask for it!

Contributing

Contributions are most welcome. If you have found a bug please create an issue. If you have a bug fix or a UX improvement please create a pull request here.

If you want to add a feature we recommend to create a fork. Let us know if you have built something cool and we can link to your project.

License

This software is licensed under the MIT License. See the LICENSE.md file.


This package is a fork of bitcoinjs-lib and is used as part of the Bitcoin Computer ecosystem.

The core Bitcoin Computer technology (object-oriented smart contracts on UTXO-based blockchains) is protected by U.S. Patent Nos. 11,188,911 and 11,694,197 (and related family members). The patented technology is currently available under free open terms for all users.

When using direct on-chain storage methods, any value transferred consists solely of the minimal technical dust required by the chosen Bitcoin primitives plus compensation for the associated UTXO hygiene service. This is not a license fee or royalty for the patented technology.

For complete details on current licensing status, grandfathering (creations before 2026-06-15), user compliance responsibilities (including securities laws and DFAL), disclaimers, and alternative licensing options, see:

LEGAL.md in the Bitcoin Computer monorepo.

BCDB Inc. provides no custody, platform, exchange, or financial services of any kind. Users write data directly to public blockchains and are solely responsible for complying with all applicable laws in their jurisdiction.

By using this package you agree to the terms described in the monorepo LEGAL.md.

Keywords