@vbyte/btc-dev
v2.1.0
Published
Batteries-included toolset for plebian bitcoin development
Maintainers
Readme
@vbyte/btc-dev
A batteries-included TypeScript toolset for Bitcoin development. Create, sign, and verify Bitcoin transactions with full support for segwit and taproot.
Installation
npm install @vbyte/btc-devQuick Example
import { ADDRESS, TX, SIGNER } from '@vbyte/btc-dev'
// Create a P2WPKH address
const address = ADDRESS.p2wpkh(pubkey, 'main')
console.log(address.data) // bc1q...
// Parse a transaction
const tx = TX.parse(rawTxHex)
// Sign and verify
const signature = SIGNER.sign_segwit_tx(secretKey, tx, {
txindex: 0,
pubkey,
sigflag: 0x01
})
const result = SIGNER.verify_tx(tx)Modules
| Module | Description |
|--------|-------------|
| ADDRESS | Create and parse addresses (P2PKH, P2SH, P2WPKH, P2WSH, P2TR) |
| TX | Transaction creation, encoding, decoding, parsing |
| SCRIPT | Script encoding, decoding, type detection |
| SIGHASH | Signature hash calculation (BIP-143, BIP-341) |
| SIGNER | Sign and verify transactions (ECDSA, Schnorr) |
| TAPROOT | Taproot trees, control blocks, tweaking |
| WITNESS | Witness data parsing and analysis |
| META | Locktime, sequence, reference IDs |
Documentation
- Guide - Complete tutorial covering addresses, transactions, signing, and taproot
- API Reference - Full function reference for all modules
- Security - Best practices for production use
- FAQ - Common questions and troubleshooting
- Conventions - Coding conventions for contributors
Contributing
See CONTRIBUTING.md for development setup and guidelines.
Dependencies
- @noble/curves - Elliptic curve cryptography
- @noble/hashes - Cryptographic hash functions
- @scure/btc-signer - Bitcoin signing utilities
- @vbyte/buff - Buffer manipulation
- zod - Runtime validation
