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

Commit

Permalink
remove resource fee/limit tables from "explainer" page
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliotFriend committed Feb 20, 2024
1 parent 7bc0f91 commit 302f382
Showing 1 changed file with 4 additions and 42 deletions.
46 changes: 4 additions & 42 deletions docs/soroban-internals/fees-and-metering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ description: Smart contract fees and metering on Soroban.
/>
</head>

:::caution

Soroban is still under active development. While the fee model described here is unlikely to change, the exact values of the fee rates and limits remain undetermined.

:::

# Fee Model

Executing a Soroban transaction on the Stellar network requires a fee. This measure helps prevent spam and allows multiple parties to compete for inclusion in the ledger in case of traffic surges. The fee is paid using the native Stellar token (lumens, also known as XLM).
Expand Down Expand Up @@ -60,28 +54,7 @@ The implementation details for fee computation are provided by the following [li

The best way to find the required fees for any Soroban transaction is to use the [`simulateTransaction` mechanism](contract-interactions/transaction-simulation.mdx).

The fee rates are currently defined for the Testnet as follows:

| Description | Cost (stroops) |
| ----------------------------------------------------- | -------------- |
| 10000 CPU instructions | 100 |
| Read 1 ledger entry | 1000 |
| Write 1 ledger entry | 3000 |
| Read 1KB from ledger | 1000 |
| 1KB of transaction (bandwidth) | 500 |
| 1KB of transaction (history) | 5000 |
| 1KB of Events/return value | 300 |
| Write 1KB to empty ledger | 1000 |
| Write 1KB to 2GB ledger | 4_000_000 |
| Write 1KB to 4GB ledger | 4_000_000_000 |
| Store 1KB temp entry for 1 month (empty ledger) | 100 |
| Store 1KB temp entry for 1 month (2GB ledger) | 400_000 |
| Store 1KB persistent entry for 1 month (empty ledger) | 1000 |
| Store 1KB persistent entry for 1 month (2GB ledger) | 4_000_000 |

Note, that write fees grow linearly from empty ledger to 2 GB (ledger "target size"), and then grow linearly, but with a 1000x factor after exceeding the target. This is to bound the ledger size growth. As Testnet is a small, test network, the target size is set to just 2 GB.

The ledger rent cost ('Store 1KB' entries in the table) is based on the write fee, rent period and some coefficient. For the temporary storage, the coefficient is 10 months (in ledgers), thus 1 month of temporary entry rent is 1/10 of the rent fee. For persistent storage the coefficient is 1 month (in ledgers) and thus 1 month of rent is equivalent to the write fee.
Currently defined fee rates can be found in [the "Resource Limits & Fees" page] in the Reference section.

### Refundable resources

Expand All @@ -93,20 +66,7 @@ Ledger close time is constrained to a few seconds, thus preventing the execution

These resource limits may change in the Mainnet release. They can also be updated, usually increased, based on the network validator vote and consensus.

The current (Testnet) limits are as follows:

| Resource | Limit |
| -------------------------- | ----------- |
| CPU Instructions | 100,000,000 |
| RAM | 40 MB |
| Ledger Entry Reads | 30 |
| Ledger Entry Writes | 20 |
| Ledger Read Bytes | 130 KB |
| Ledger Write Bytes | 65 KB |
| Transaction Size | 70 KB |
| Events & return value size | 2 KB |
| Ledger entry size | 64 KB |
| Maximum TTL | 6 months |
Currently defined resource limits can be found in [the "Resource Limits & Fees" page] in the Reference section.

# Metering

Expand Down Expand Up @@ -154,3 +114,5 @@ Before contract execution, the host environment is prepared with the cost parame
During execution, whenever a component (a code block defining a cost type) is encountered, the corresponding model computes the resource output from the runtime input and increments the meter accordingly. The meter checks the cumulative consumption against the budget limit. If the limit is exceeded, an error is produced, and execution is terminated.

If the contract execution concludes within the specified resource limits, the metered total of CPU instructions is recorded and utilized as the input for fee calculation. Note that while memory usage is not included in the fee computation, it is nevertheless subject to the resource limits.

[the "Resource Limits & Fees" page]: ../reference/resource-limits-fees.mdx

0 comments on commit 302f382

Please sign in to comment.