Send SOL
Send native SOL and estimate transaction fees on Solana.
This guide explains how to send native SOL, sign a transaction without broadcasting, quote and send a signed transaction, estimate transaction fees, cap native transaction fees, quote or send a TransactionMessage, use dynamic fee rates, and run a complete SOL transfer flow.
BigInt Usage: Always use BigInt (the n suffix) for monetary values to avoid precision loss with large numbers.
On Solana, values are expressed in lamports (1 SOL = 10^9 lamports). Fees are calculated based on the recent blockhash and instruction count.
Send Native SOL
Use account.sendTransaction() to transfer SOL to a recipient address.
const result = await account.sendTransaction({
to: 'publicKey', // Recipient's base58-encoded public key
value: 1000000000n // 1 SOL in lamports
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee, 'lamports')Sign a Transaction Without Broadcasting
Use account.signTransaction() when you need a fully signed transaction but want another process to review, relay, or submit it.
const signedTransaction = await account.signTransaction({
to: '11111111111111111111111111111112',
value: 1000000000n
})
console.log('Signed transaction:', signedTransaction)Quote and Send a Signed Transaction
Pass the FullySignedTransaction returned by signTransaction() to the quote and send methods when review and submission are separate steps.
const signedTransaction = await account.signTransaction({
to: '11111111111111111111111111111112',
value: 1000000000n
})
const quote = await account.quoteSendTransaction(signedTransaction)
console.log('Estimated fee:', quote.fee, 'lamports')
const result = await account.sendTransaction(signedTransaction)
console.log('Transaction signature:', result.hash)Signing seals the recent blockhash or durable nonce into the message. WDK broadcasts the signed bytes unchanged and does not refresh the transaction lifetime or re-sign it. Submit the transaction before that lifetime becomes invalid. sendTransaction() quotes it again and enforces transactionMaxFee.
Estimate Transaction Fees
Use account.quoteSendTransaction() to get a fee estimate before sending.
const quote = await account.quoteSendTransaction({
to: 'publicKey',
value: 1000000000n
})
console.log('Estimated fee:', quote.fee, 'lamports')Cap Native Transaction Fees
Set transactionMaxFee when you create the wallet to stop native sendTransaction() and signTransaction() calls if the estimated fee is greater than your limit. A fee equal to the configured cap is allowed. Use transferMaxFee separately for SPL token transfers.
const wallet = new WalletManagerSolana(seedPhrase, {
provider: 'https://api.mainnet-beta.solana.com',
transactionMaxFee: 10000000n // 0.01 SOL in lamports
})Quote or Send a TransactionMessage
Use a prebuilt TransactionMessage when you need custom instructions or a durable nonce flow.
If the transaction message already includes a recent blockhash or durable nonce lifetime, WDK preserves it. If it does not, WDK fetches the latest blockhash before quoting or sending. When you set feePayer, it must match the wallet address.
const quote = await account.quoteSendTransaction(txMessage)
console.log('Estimated fee:', quote.fee, 'lamports')
const result = await account.sendTransaction(txMessage)
console.log('Transaction hash:', result.hash)Use Dynamic Fee Rates
Retrieve current fee rates using wallet.getFeeRates(). Rates are calculated based on the recent blockhash and compute unit prices.
const feeRates = await wallet.getFeeRates()
console.log('Normal fee rate:', feeRates.normal, 'lamports')
console.log('Fast fee rate:', feeRates.fast, 'lamports')Complete Example
async function sendSOLTransfer(account, wallet) {
const solBalance = await account.getBalance()
const transferAmount = 1000000000n // 1 SOL
if (solBalance < transferAmount) {
throw new Error('Insufficient SOL balance')
}
const quote = await account.quoteSendTransaction({
to: '11111111111111111111111111111112',
value: transferAmount
})
console.log('Estimated fee:', quote.fee, 'lamports')
const result = await account.sendTransaction({
to: '11111111111111111111111111111112',
value: transferAmount
})
console.log('Transaction hash:', result.hash)
console.log('Fee paid:', result.fee, 'lamports')
return result
}Next Steps
To transfer SPL tokens instead of native SOL, see Transfer SPL Tokens.