Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Elliot Voris <elliot@stellar.org>
Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 23, 2024
1 parent a0e97dc commit 8f1c21d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions docs/soroban-internals/fees-and-metering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,16 @@ The Soroban transaction fee is the sum of two parts:

`Transaction Fee (Tx.fee) = Resource Fee (sorobanData.resourceFee) + Inclusion Fee`

<img src={soroban_fees} alt="Soroban Fees" />
<em>
*Chart: Solid line boxes are what is actually present in the transaction.
While dotted lines are derivable.
</em>
![Soroban Fees](/img/soroban_fees.png)
_\* Chart: Solid line boxes are what is actually present in the transaction, while dotted lines are derivable._

### Inclusion Fee

- The inclusion fee is the maximum bid the submitter is willing to pay for inclusion of the transaction. The network uses market dynamics to decide which transaction to include in the ledger — transactions that offer a higher fee are included in the ledger before those with lower inclusion fees. Therefore, inclusion fee is used to prioritize transactions. The inclusion fee can be discounted depending on the traffic. If the ledger is not at capacity, only the minimal base inclusion fee is charged (100 stroops or 10^-5 XLM). If the ledger is at capacity, then the lowest inclusion fee bid is charged. In general, the behavior of the inclusion fee and bidding strategies align with the [classic Stellar fees](https://developers.stellar.org/docs/encyclopedia/fees-surge-pricing-fee-strategies).

### Resource Fee

- The resource fee is the amount of Lumens the submitter must pay for their transaction to be included in the ledger. It depends solely on the amount of resources the transaction needs for execution. There is no auction for the resources fee; it simply must be paid if the transaction is included in the ledge.
- The resource fee is the amount of Lumens the submitter must pay for their transaction to be executed. It depends solely on the amount of resources the transaction needs for execution. There is no auction for the resources fee; it simply must be paid if the transaction is included in the ledger.

Soroban uses a multi-dimensional resource fee model that charges fees for several resource types using network-defined rates. The resources fee is calculated based on the resources consumption declared in the transaction. If the transaction attempts to exceed the declared resource limits, the transaction will fail. If the transaction uses fewer resources than declared, there will be no refunds, with a few exceptions.

Expand All @@ -65,7 +62,7 @@ Some parameters may contribute to multiple fee components. For example, the tran

The implementation details for fee computation are provided by the following [library](https://github.com/stellar/rs-soroban-env/blob/main/soroban-env-host/src/fees.rs). This library is used by the protocol to compute the fees and thus can be considered canonical. The resource fee rates may be updated based on network validator consensus.

### Breakdown the Resource Fee
### Understanding the Resource Fee

ResourceFee is calculated with a non-refundable fees portion and a refundable fees portion.
`Resource Fee(sorobanData.resourceFee) = Non-refundable resource fees + Refundable resource fees`
Expand Down Expand Up @@ -139,4 +136,4 @@ If the contract execution concludes within the specified resource limits, the me

### Current Fee Rates

Currently defined fee rates can be found in [Resource Limits & Fees](../reference/resource-limits-fees.mdx) page.
Currently defined fee rates can be found in the [Resource Limits & Fees](../reference/resource-limits-fees.mdx) page.

0 comments on commit 8f1c21d

Please sign in to comment.