Client-side Bitcoin JavaScript library for node.js and browsers with comprehensive Bitcoin protocol support
Overall
score
99%
Build a utility that creates and signs Bitcoin transactions using Taproot key-path spending. The utility handles creating Taproot payment outputs and signing transactions with Schnorr signatures.
@generates
/**
* Creates a P2TR (Pay-to-Taproot) payment object from an internal public key.
*
* @param {Buffer} internalPubkey - The 32-byte x-only internal public key
* @param {Object} options - Configuration options
* @param {Object} options.network - Bitcoin network (mainnet, testnet, regtest)
* @returns {Object} Payment object with address, output script, and witness program
*/
function createTaprootPayment(internalPubkey, options) {
// IMPLEMENTATION HERE
}
/**
* Signs a Taproot input using key-path spending with a Schnorr signature.
*
* @param {Object} transaction - The transaction builder or PSBT object
* @param {number} inputIndex - Index of the input to sign
* @param {Buffer} privateKey - The 32-byte private key for signing
* @param {number} prevOutValue - The value in satoshis of the output being spent
* @param {number} sighashType - The signature hash type (default: SIGHASH_ALL)
* @returns {Buffer} The Schnorr signature
*/
function signTaprootKeyPath(transaction, inputIndex, privateKey, prevOutValue, sighashType) {
// IMPLEMENTATION HERE
}
/**
* Builds a complete transaction spending from a Taproot output to a new Taproot output.
*
* @param {Object} input - Input UTXO details
* @param {Buffer} input.txid - Transaction ID of the UTXO
* @param {number} input.vout - Output index
* @param {number} input.value - Value in satoshis
* @param {Buffer} input.internalPubkey - Internal public key of the input
* @param {Object} output - Output details
* @param {Buffer} output.internalPubkey - Internal public key for the output
* @param {number} output.value - Value in satoshis
* @param {Buffer} signingKey - Private key for signing the input
* @param {Object} network - Bitcoin network configuration
* @returns {Object} Complete transaction with witness data
*/
function buildTaprootTransaction(input, output, signingKey, network) {
// IMPLEMENTATION HERE
}
module.exports = {
createTaprootPayment,
signTaprootKeyPath,
buildTaprootTransaction,
};Provides Bitcoin transaction creation, Taproot support, and cryptographic operations.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-bitcoinjs-libdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10