FeeBumpTransaction

Represents a Fee Bump Transaction in the Stellar network.

Fee bump transactions allow you to increase the fee of a previously submitted transaction that may be stuck in the queue due to insufficient fees. This is useful when network fees spike unexpectedly or when you need to prioritize a transaction.

How Fee Bumps Work

A fee bump transaction wraps an existing transaction (the "inner transaction") and specifies a new, higher fee. The fee bump transaction has its own source account (the "fee source") which pays the additional fee. This allows a different account to sponsor the fee increase.

Important Rules

  1. The inner transaction must NOT already be a fee bump transaction

  2. The new fee must be higher than the inner transaction's fee

  3. The inner transaction can have any number of operations (1-100)

  4. The fee bump adds one additional "operation" for fee calculation purposes

  5. Both the inner transaction and fee bump transaction require signatures

Fee Calculation

When using base fee (recommended):

maxFee = (baseFee × (numInnerOperations + 1)) + sorobanResourceFee

The "+1" accounts for the fee bump operation itself.

Usage Example

// Original transaction stuck due to low fee
val originalTx = TransactionBuilder(sourceAccount, Network.PUBLIC)
.addOperation(PaymentOperation(...))
.setBaseFee(100)
.build()
originalTx.sign(sourceKeypair)

// Create fee bump to increase priority
val feeBump = FeeBumpTransaction.createWithBaseFee(
feeSource = "GFEE...", // Account paying the additional fee
baseFee = 1000, // New base fee (must be higher)
innerTransaction = originalTx
)

// Sign with fee source account
feeBump.sign(feeSourceKeypair)

// Submit the fee bump transaction
horizonServer.submitTransaction(feeBump)

Network Behavior

  • If the inner transaction has already been applied, the fee bump will fail

  • If the inner transaction is in the queue, it will be replaced by the fee bump

  • The fee source account must have sufficient balance to cover the fee increase

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val fee: Long

The maximum fee willing to be paid for this transaction (in stroops)

Link copied to clipboard

The account paying for the transaction fee (G... or M... address)

Link copied to clipboard

The inner transaction being wrapped

Link copied to clipboard

The network this transaction is for

Link copied to clipboard

List of signatures attached to this transaction.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
suspend fun hash(): ByteArray

Returns the transaction hash (SHA-256 of signature base).

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
suspend fun hashHex(): String

Returns the transaction hash as a lowercase hexadecimal string.

Link copied to clipboard
suspend fun sign(signer: KeyPair)

Adds a signature by signing the transaction hash with the provided keypair.

Link copied to clipboard
open suspend override fun signatureBase(): ByteArray

Returns the signature base for this fee bump transaction.

Link copied to clipboard
suspend fun signHashX(preimage: ByteArray)

Adds a hash(x) signature by revealing the preimage.

Link copied to clipboard

Generates the transaction envelope XDR object for submission to the network.

Link copied to clipboard

Returns base64-encoded TransactionEnvelope XDR.