Send and Transfer
Send native Spark, transfer tokens, and estimate fees.
This guide explains how to send native Spark, transfer tokens, and estimate fees.
Send Spark
- Build the recipient Spark address and amount in satoshis.
- Call
account.sendTransaction().
You can send native Spark (satoshis) using account.sendTransaction():
const result = await account.sendTransaction({
to: 'spark1...',
value: 1000000
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee)On-chain Spark transfers report fee as 0. Memos are not supported on sendTransaction(). Use valid Spark network addresses.
account.signTransaction() is exposed for IWalletAccount compatibility, but it always throws on Spark. Spark transfers are collaboratively signed with Spark operators, so a standalone signed payload cannot be produced for separate broadcast. Use account.sendTransaction() for Spark sends.
If you enable syncAndRetry, account.sendTransaction() submits at most once. After a failed response it syncs state and looks for the submitted transfer in history instead of sending again. A failed initial history read prevents submission. Avoid concurrent sends with the same recipient and amount from one wallet, because history matching cannot tell them apart.
You can enable this recovery behavior when constructing the wallet:
const wallet = new WalletManagerSpark(seedPhrase, {
network: 'MAINNET',
syncAndRetry: true,
})
const account = await wallet.getAccount(0)
await account.sendTransaction({
to: 'spark1...',
value: 1000000,
})Transfer Tokens
You can move tokens to another Spark address using account.transfer():
const transferResult = await account.transfer({
token: 'btkn1...',
amount: BigInt(1000000),
recipient: 'spark1...'
})
console.log('Transfer hash:', transferResult.hash)
console.log('Transfer fee:', Number(transferResult.fee))Token identifiers use Bech32m (for example btkn1...). Amounts use the token’s base units.
Estimate Fees
Spark native and token transfer quotes
You can preview the fee for a native send using account.quoteSendTransaction():
const quote = await account.quoteSendTransaction({
to: 'spark1...',
value: 1000000
})
console.log('Estimated fee:', quote.fee)You can preview the fee for a token transfer using account.quoteTransfer():
const transferQuote = await account.quoteTransfer({
token: 'btkn1...',
amount: BigInt(1000000),
recipient: 'spark1...'
})
console.log('Estimated transfer fee:', Number(transferQuote.fee))Wallet-level fee rates
You can read wallet-level fee rate placeholders using wallet.getFeeRates():
const feeRates = await wallet.getFeeRates()
console.log('Normal:', feeRates.normal)
console.log('Fast:', feeRates.fast)Spark network fees for native sends and token transfers are zero; wallet.getFeeRates() returns { normal: 0n, fast: 0n }. Lightning flows can still incur fees; see Lightning payments.
To refresh wallet state, call account.syncWalletBalance():
await account.syncWalletBalance()A sync does not establish that an earlier payment failed. Check transfer history before deciding whether to send again.
Next Steps
Learn how to create and pay Lightning invoices.