# Transaction fees

When you transact on a ledger, the fees you need to pay are a combination of the fees set by the ledger itself and a strategy you specify in Ripple Custody to trade off the priority of the transaction against the cost.

At transaction execution, Ripple Custody calculates the fee by calling the dry run operation, and then adjusts the calculation based on various factors, including the fee strategy you select and the ledger requirements.

For more information about the dry run operation, see [Dry run intents](/products/custody/v1.26/api/get-started/key-operations/update/dry-run).

The information below describes the different fee settings available for different ledgers, and how to set fees to ensure your transaction completes successfully at a fee level you are comfortable with. The settings apply to all transactions, such as sending funds, calling smart contracts, and staking.

## Fee strategy and maximum fee

The following values together define your required approach to transaction fees:

- Fee strategy: Indicates how you want fees to be applied. For example, whether you want Ripple Custody to apply a specific fee or calculate a fee based on priority
- Maximum fee: Sets the threshold for fees above which the transaction cannot be broadcast


### Fee strategy

The fee strategy represents a measure of how quickly you want the transaction to be verified by the miner. It impacts the amount of fees that you pay: at transaction execution, Ripple Custody adjusts the fees according to the strategy you define.

Ledger fees change regularly. The fee Ripple Custody calculates is an indication, and may not reflect the final fee the transaction incurs when executed on the blockchain.

#### Fee strategy types

This following table provides an overview of all the fee strategies you can use for transactions, including no strategy and fee payment by the beneficiary. For more information about how different ledgers apply these strategies, see [Fee strategies by ledger](#fee-strategies-by-ledger).

| Type | Description |
|  --- | --- |
| No strategy | When you do not specify a strategy, Ripple Custody calculates the fee and this is the only fee available. |
| Priority | Ripple Custody calculates the fee and then adjusts the amount based on the priority you define. This strategy helps mitigate issues with volatile fee rates. It's also the only strategy available for transfer orders. For more information, see [Transfer order](/products/custody/v1.26/overview/blockchain/transactions/transaction-initiation#transfer-order). |
| Specified rate / Specified rate EP 1159 | Ripple Custody uses the fee you specify, adjusted for any limitations of the ledger, such as a minimum fee.You can use the [Get ledger fee details](/products/custody/v1.26/api/reference/openapi/ledgers/getledgerfees) operation or the fee estimate displayed in the UI to help set the rate, however, a reasonable rate can change considerably between the time you create the transaction and the time the transaction is broadcast. For this reason, we recommend you use a priority fee strategy. |
| Specified additional fee | Ripple Custody applies the fee on top of the base fee of the ledger. |
| Predefined | This is an internal fee strategy imposed by the ledger. For ledgers that impose a predefined strategy, the ledger always calculates the fee using its own criteria, irrespective of the fee strategy you specify. |
| Beneficiary pays | The beneficiary pays the fees. |


### Maximum fee

The maximum fee is an optional value that you can use to set a cap on the fee, irrespective of the priority set. This acts as a safeguard, since it ensures that you know the maximum cost of the transaction in advance. If the current state of the blockchain means the transaction fees exceed this threshold, Ripple Custody keep the transaction in `Preparing` status until network conditions make it possible to broadcast it within the acceptable fee level, at which time Ripple Custody automatically broadcasts the transaction.

For more information about transaction statuses, see [Transaction statuses](/products/custody/v1.26/overview/blockchain/transactions/transaction-processing#transaction-statuses).

The way to ensure low fees is to use a fee strategy and not a maximum fee, as the maximum fee is a safety harness, not a transaction setting.

## Fee strategies by ledger

The following table provides an overview of the fee strategy types available for each ledger, and the adjustments Ripple Custody makes to the fee calculation to take into account specific ledger requirements.

For more information about fee calculations, see [Fee strategy types](#fee-strategy-types).

The only fee strategy available when sending assets using a transfer order is the priority strategy.

| Ledger | Fee strategy types available | Details |
|  --- | --- | --- |
| Bitcoin-typeFor a full list, see [Bitcoin-type ledgers](/products/custody/v1.26/support/supported-ledgers#bitcoin-type-ledgers) | Priority, specified rate, beneficiary pays | Ripple Custody calculates Satoshi per vByte according to the strategy you choose.For Bitcoin-type ledgers, if the amount of the transaction is lower than the fees, the ledger may consider the transaction as dust and reject it. Due to the nature of Bitcoin-type transactions, any changes to the ledger during transaction execution can result in a transaction considered as dust. In a scenario such as this, Ripple Custody adds the dust amount to the current transaction fee. This mechanism permits the correct execution of the transaction on chain. |
| EVMFor a full list, see [EVM ledgers](/products/custody/v1.26/support/supported-ledgers#ethereum-virtual-machine-evm-ledgers) | Priority, specified rate, specified rate EIP 1559 | Ripple Custody calculates the gas price as follows:**Priority**: Ripple Custody prioritizes the use of EIP 1559 rates for the ledgers that support it. For any other ledgers, such as Binance, Ripple Custody uses legacy rates.**Specified rate EIP 1559**: This fee strategy type is the current way of specifying fees for EVM chains that support EIP 1559. If you choose this rate, you can also specify the following values:**Max fee per gas**: A maximum fee amount to use as a cap.**Max priority fee per gas**: A maximum fee amount to speed up the transaction.EIP 1559 introduces a base price, which represents the minimum fee you must pay for a transaction to include it in a block. The blockchain itself sets this fee on a per-block basis. The final gas price paid is generally the sum of the base price, set by the chain, and the max priority fee per gas, set by you.However, if the sum of the base price and the max priority fee per gas exceeds the maximum fee, then the final gas price paid is capped at max fee per gas. The final cost of the transaction is obtained when the final price paid is multiplied by the gas amount.**Specified rate**: This fee strategy type is the legacy way of specifying fees for EVM chains that don't support the EIP 559 rate, such as Binance. If you choose this type, the fee amount you specify as the gas price is multiplied by the transfer amount to give the final transaction cost. For Ethereum, the lowest amount of gas for the simplest transaction is 21'000 gas units. If the cost of the gas is 1 Gwei, then the total cost of a simple transaction is 21'000 * 1 = 21'000 Gwei or 21'000'000'000'000 Wei. It is important to consider an appropriate gas price when making this estimation. |
| XRPL | Priority, specified additional fee | Depending on the strategy you use, Ripple Custody calculates fees as follows:**Priority**: Ripple Custody takes the base price specified by the XRPL network and applies a multiplier (factor) that is based on the priority level you define.**Specified additional fee**: Ripple Custody adds this amount to the base price. If you only want to pay the base price, you can specify 0.In addition, an XRPL account must have a minimum balance of 10 XRP, plus 2 XRP for each object held on the account.You need to take these figures into consideration when you calculate a maximum fee. |
| Hedera | Predefined | The fee paid for a transaction is predefined and depends on the operation type and the time at which the transaction is executed (based on the exchange rate USD/HBAR). Contrary to other ledgers, it is not possible to incentivize miners. You can use a Hedera online tool to predict the value of the fee for each operation. In addition, Ripple Custody imposes a minimum balance for every Hedera account of 2 HBAR, to cover the Hedera-imposed account renewal fee.If any transaction you initiate would reduce the account balance below the minimum threshold of 2 HBAR, Ripple Custody will not broadcast it, and the transaction will stay in `Preparing` status. |
| Stellar | Priority | Ripple Custody applies the minimal fee cost for Stellar transactions of 0.00001 XLM (100 Stroops). |
| Algorand | No strategy | Ripple Custody sets the final fee you pay as the maximum between the minimal fee value of 1000 microAlgos and the fee per bytes multiplied by the transaction size.An Algorand account must have a minimum balance of 100'000 microAlgos. If any transaction you initiate would reduce the account balance below that amount, Ripple Custody will not broadcast it, and the transaction will stay in `Preparing` status. |
| Cardano | No strategy, beneficiary pays | For no strategy, fees are set by the ledger |
| Polkadot | No strategy | Fees set by ledger |
| Tezos | Priority | Fees set by ledger |
| Solana | Priority | Fees set by ledger |