@ordinalsbot/bitcoin-fee-estimator
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Bitcoin Fee Calculator

Node Version

A TypeScript library for accurately calculating Bitcoin transaction sizes, virtual bytes (vBytes), and fees for various script types including SegWit and Taproot.

Features

  • Calculate transaction sizes in both vBytes and raw bytes
  • Support for all standard script types:
    • Legacy (P2PKH, P2SH)
    • SegWit (P2WPKH, P2WSH)
    • Taproot (P2TR)
    • Nested SegWit (P2SH-P2WPKH, P2SH-P2WSH)
  • OP_RETURN data size calculation
  • Fee estimation based on sat/vByte
  • Inscription transaction fee calculation

Supported Script Types

Type Description
P2PKH Legacy Pay-to-Public-Key-Hash
P2SH Pay-to-Script-Hash
P2WPKH Native SegWit
P2WSH SegWit Script
P2TR Taproot
P2SH-P2WPKH Nested SegWit in P2SH
P2SH-P2WSH Nested SegWit Script in P2SH

Development

  1. Clone the repository:

    git clone https://github.com/ordinalsbot/bitcoin-fee-estimator.git
    cd bitcoin-fee-estimator
  2. Optional - Using nvm:

    nvm install  # Uses version from .nvmrc
    nvm use      # Switches to correct Node version
  3. Install dependencies:

    npm install
  4. Run tests:

    npm test
  5. Build the project:

    npm run build

Package Sidebar

Install

npm i @ordinalsbot/bitcoin-fee-estimator

Weekly Downloads

12

Version

0.1.1

License

ISC

Unpacked Size

46.7 kB

Total Files

29

Last publish

Collaborators

  • ordinarius
  • dcorral