@ordinalsbot/bitcoin-fee-estimator
v0.1.7
Published
A library for calculating Bitcoin transaction fees
Downloads
94
Readme
Bitcoin Fee Calculator
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
Clone the repository:
git clone https://github.com/ordinalsbot/bitcoin-fee-estimator.git cd bitcoin-fee-estimatorOptional - Using nvm:
nvm install # Uses version from .nvmrc nvm use # Switches to correct Node versionInstall dependencies:
npm installRun tests:
npm testBuild the project:
npm run build
