Send Transactions
Send BTC and estimate transaction fees.
This guide explains how to send BTC, estimate fees before sending, use a custom fee rate, and target a specific confirmation time.
Send BTC
You can send Bitcoin to a recipient using account.sendTransaction():
const result = await account.sendTransaction({
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
value: 100000n // 0.001 BTC in satoshis
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee, 'satoshis')Bitcoin transactions support a single recipient only. Amounts and fees are always in satoshis (1 BTC = 100,000,000 satoshis). The minimum amount must be above the dust limit (294 satoshis for SegWit, 546 for legacy).
Extend Post-Broadcast Polling
If you want account.sendTransaction() to keep polling after broadcast until spent inputs disappear from the unspent-output set, pass the optional timeoutMs argument:
const result = await account.sendTransaction(
{
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
value: 100000n,
},
30000
)
console.log('Transaction hash:', result.hash)If you omit timeoutMs, the wallet uses the default post-broadcast polling window before returning.
Estimate Fees
You can estimate the fee for a transaction without broadcasting it using account.quoteSendTransaction():
const quote = await account.quoteSendTransaction({
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
value: 100000n
})
console.log('Estimated fee:', quote.fee, 'satoshis')Send with Custom Fee Rate
You can override automatic fee estimation by providing a feeRate in sat/vB to account.sendTransaction():
const result = await account.sendTransaction({
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
value: 100000n,
feeRate: 10n // sat/vB
})When feeRate is provided, the confirmationTarget parameter is ignored.
Send with Confirmation Target
You can target a specific number of blocks for confirmation using the confirmationTarget parameter in account.sendTransaction():
const result = await account.sendTransaction({
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
value: 100000n,
confirmationTarget: 6 // target 6 blocks (~1 hour)
})Next Steps
Learn how to view transaction history.