Skip to main content
Fee breakdown for Lightning payments, cooperative exits, and swaps.

For Bitcoin
Transaction TypeFee structure
L1 to SparkOn-chain fee paid by the user
Spark to SparkFree. Small flat fee coming in 6-12 months
Spark to Lightning0.25% + routing fee
Lightning to Spark0.15% (charged on routing nodes via route hints)
Send to L1sats_per_vbyte × (111 × 2 + tx_vbytes)
Unilateral ExitOn-chain fee paid by the user

For BTKN assets
Transaction TypeFee structure
Spark to SparkFree
Unilateral ExitOn-chain fee + bond locked by user
Some of the fees are sourced directly from the Lightspark SSP, specifically for Spark–Lightning interactions. Lightspark is the first SSP on Spark, but the system is open. Anyone can run an SSP (SSP specs coming soon). If you’re an SSP, reach out, and we’ll include your fee structure.

Fee Estimation Flow

The complete process for estimating fees before making transactions:
1

Choose Operation Type

Determine which type of operation you want to estimate fees for.
// Lightning payment
const lightningInvoice = "lnbc...";

// Cooperative exit (withdrawal to L1)
const withdrawalAmount = 10000;
const withdrawalAddress = "bc1p...";

// Swap operation
const swapAmount = 5000;
2

Get Fee Estimate

Call the appropriate fee estimation method.
// Lightning send fee estimate
const lightningFee = await wallet.getLightningSendFeeEstimate({
  encodedInvoice: lightningInvoice
});

// Cooperative exit fee estimate
const exitFee = await wallet.getWithdrawalFeeQuote({
  amountSats: withdrawalAmount,
  withdrawalAddress: withdrawalAddress
});

// Swap fee estimate
const swapFee = await wallet.getSwapFeeEstimate(swapAmount);
3

Review Fee Details

Examine the fee estimate response to understand costs.
console.log("Lightning fee estimate:", lightningFee, "sats");
console.log("Exit fee estimate:", exitFee);
console.log("Swap fee estimate:", swapFee);
4

Proceed with Transaction

Use the fee estimate to set appropriate limits for your transaction.
// Use fee estimate for Lightning payment
const payment = await wallet.payLightningInvoice({
  invoice: lightningInvoice,
  maxFeeSats: lightningFee + 5 // Add buffer to fee estimate
});

Lightning Send Fee Estimates

Estimate fees for sending Lightning payments before making the transaction. getLightningSendFeeEstimate(params) Gets an estimated fee for sending a Lightning payment. Note: the actual fee assessed may be different from the fee estimate as it will be determined by the actual Lightning node routing.
const feeEstimateSats = await wallet.getLightningSendFeeEstimate({
  encodedInvoice: "lnbcrt1u1pnm7ammpp4v84f05tl0kzt6g95g056athdpp8f8azvg6d7epz74z562ymer9jqsp5nc50gazvp0e98u42jlu653rw0eutcl067nqq924hf89q4la4kd9sxq9z0rgqnp4qdnmwu8v22cvq9xsv2l05cn9rre7xlcgdtntxawf8m0zxq3qemgzqrzjqtr2vd60g57hu63rdqk87u3clac6jlfhej4kldrrjvfcw3mphcw8sqqqqrj0q7ew45qqqqqqqqqqqqqq9qcqzpgdq5w3jhxapqd9h8vmmfvdjs9qyyssqj7lf2w4m587g04n4t0ferdv0vnwftzca0xuc9yxycng78cnhrvmyw2mzaa8t76jskpypqnwqhp9xh0vnwxz90jytd34vrmhcngsnl8qplz7ylk"
});

console.log("Lightning send fee estimate:", feeEstimateSats, "sats");

Example Response

100 // fee estimate in satoshis

Sending on L1 Fee Estimates

Estimate fees for sending funds on the Bitcoin network. getWithdrawalFeeQuote(params) Gets a fee quote for a cooperative exit (on-chain withdrawal). The quote includes options for different speeds and an expiry time and must be passed to withdraw before it expires.
const exitFeeEstimate = await wallet.getWithdrawalFeeQuote({
  amountSats: 10000,
  withdrawalAddress: "bc1p5d7rjq7g6rdk2yhzks9smtbqtedr4dekq08ge8ztwac72sfr9rusxg3297"
});

console.log("Cooperative exit fee estimate:", exitFeeEstimate);

Example Response

{
  feeEstimate: {
    originalValue: 1000,
    originalUnit: 'SATOSHI',
    preferredCurrencyUnit: 'USD',
    preferredCurrencyValueRounded: 0.50,
    preferredCurrencyValueApprox: 0.483
  }
}

Swap Fee Estimates

Estimate fees for leaves swap operations. Leaves swaps are internal wallet optimization operations that consolidate or split your sats leaves. getSwapFeeEstimate(amountSats) Gets the estimated fee for a swap of leaves.
const swapFeeEstimate = await wallet.getSwapFeeEstimate(5000);
console.log("Swap fee estimate:", swapFeeEstimate);

Fee Deduction Options

For cooperative exits, you can choose how fees are handled:

Deduct Fee from Withdrawal Amount

When deductFeeFromWithdrawalAmount is set to true:
import { ExitSpeed } from "@buildonspark/spark-sdk";

const withdrawal = await wallet.withdraw({
  onchainAddress: "bc1p...",
  exitSpeed: ExitSpeed.MEDIUM,
  amountSats: 10000, // This is the net amount you'll receive
  feeQuote: feeQuote,
  deductFeeFromWithdrawalAmount: true // Fee deducted from amount
});
// You receive: 10000 sats - fee

Pay Fee Separately

When deductFeeFromWithdrawalAmount is set to false:
import { ExitSpeed } from "@buildonspark/spark-sdk";

const withdrawal = await wallet.withdraw({
  onchainAddress: "bc1p...",
  exitSpeed: ExitSpeed.MEDIUM,
  amountSats: 10000, // This is the gross amount you'll receive
  feeQuote: feeQuote,
  deductFeeFromWithdrawalAmount: false // Fee paid separately
});
// You receive: 10000 sats (fee paid from wallet balance)