🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

btctx

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btctx

Build and sign Bitcoin Taproot transactions

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

txbuilder

npm version npm downloads license node

Build and sign Bitcoin Taproot transactions.

Installation

npm install txbuilder

Usage

As a module

import { buildTx } from 'txbuilder';

const result = await buildTx({
  privateKey: '0123456789abcdef...', // 64-char hex
  publicKey: 'fedcba9876543210...',  // 64-char hex (x-only)
  txid: 'abc123...',                 // Input txid
  vout: 0,                           // Input index
  inputAmount: 100000,               // Input satoshis
  outputs: [
    { pubkey: 'dest123...', amount: 99000 }
  ]
});

console.log(result.hex);     // Raw transaction hex
console.log(result.txid);    // Transaction ID
console.log(result.address); // Sender's Taproot address

As CLI

# Single output
txbuilder <privateKey> <publicKey> <txid> <vout> <inputAmount> <destPubkey> <destAmount>

# Multiple outputs
txbuilder <privkey> <pubkey> <txid> 0 100000 <dest1> 49000 <dest2> 49000

# Show help
txbuilder --help

API

buildTx(options)

Build and sign a Taproot transaction.

Options:

  • privateKey (string) - 64-char hex private key for signing
  • publicKey (string) - 64-char hex public key (x-only)
  • txid (string) - Input transaction ID
  • vout (number) - Input transaction output index (default: 0)
  • inputAmount (number) - Input amount in satoshis
  • outputs (array) - Array of {pubkey, amount} objects
  • network (string) - Network: mainnet, testnet, regtest (default: mainnet)
  • verify (boolean) - Verify signature after signing (default: true)

Returns: Promise<{hex, txid, address, txdata}>

getPublicKey(privateKey)

Derive x-only public key from private key.

getAddress(publicKey, network?)

Generate Taproot (P2TR) address from public key.

Dependencies

License

MIT

Keywords

bitcoin

FAQs

Package last updated on 05 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts