This repository was archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[docs] updated "transaction fees" page #26861
Merged
jacobcreech
merged 6 commits into
solana-labs:master
from
nickfrosty:docs-transaction-fees
Aug 18, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d30aa01
docs: transaction fees, compute units, compute budget
nickfrosty 3c56156
docs: added messages definition
nickfrosty 3daa4d6
Revert "docs: added messages definition"
nickfrosty c6ecd33
docs: added messages definition
nickfrosty e0c4e21
Update docs/src/transaction_fees.md
nickfrosty 1a37576
fix: updates from feedback
nickfrosty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,70 @@ | ||
| --- | ||
| title: Transaction Fees | ||
| description: "Transaction fees are the small fees paid to process instructions on the network. These fees are based on computation and an optional prioritization fee." | ||
| keywords: "instruction fee, processing fee, storage fee, low fee blockchain, gas, gwei, cheap network, affordable blockchain" | ||
| --- | ||
|
|
||
| **Subject to change.** | ||
| The small fees paid to process [instructions](./terminology.md#instruction) on the Solana blockchain are known as "_transaction fees_". | ||
|
|
||
| Each transaction sent through the network, to be processed by the current leader validation-client and confirmed as a global state transaction, contains a transaction fee. Transaction fees offer many benefits in the Solana economic design, for example they: | ||
| As each transaction (which contains one or more instructions) is sent through the network, it gets processed by the current leader validation-client. Once confirmed as a global state transaction, this _transaction fee_ is paid to the network to help support the [economic design](#economic-design) of the Solana blockchain. | ||
|
|
||
| - provide unit compensation to the validator network for the CPU/GPU resources necessary to process the state transaction, | ||
| > **NOTE:** Transaction fees are different from [account rent](./terminology.md#rent)! | ||
| > While transaction fees are paid to process instructions on the Solana network, rent is paid to store data on the blockchain. | ||
|
|
||
| <!-- > You can learn more about rent here: [What is rent?](./developing/intro/rent.md) --> | ||
|
|
||
| ## Why pay transaction fees? | ||
|
|
||
| Transaction fees offer many benefits in the Solana [economic design](#basic-economic-design) described below. Mainly: | ||
|
|
||
| - they provide compensation to the validator network for the CPU/GPU resources necessary to process transactions, | ||
| - reduce network spam by introducing real cost to transactions, | ||
| - and provide potential long-term economic stability of the network through a protocol-captured minimum fee amount per transaction, as described below. | ||
| - and provide potential long-term economic stability of the network through a protocol-captured minimum fee amount per transaction | ||
|
|
||
| > **NOTE:** Network consensus votes are sent as normal system transfers, which means that validators pay transaction fees to participate in consensus. | ||
|
|
||
| ## Basic economic design | ||
|
|
||
| Many current blockchain economies \(e.g. Bitcoin, Ethereum\), rely on _protocol-based rewards_ to support the economy in the short term. And when the protocol derived rewards expire, predict that the revenue generated through _transaction fees_ will support the economy in the long term. | ||
|
|
||
| In an attempt to create a sustainable economy on Solana through _protocol-based rewards_ and _transaction fees_: | ||
|
|
||
| - a fixed portion (initially 50%) of each transaction fee is _burned_ (aka destroyed), | ||
| - with the remaining fee going to the current [leader](./terminology.md#leader) processing the transaction. | ||
|
|
||
| A scheduled global inflation rate provides a source for [rewards](./implemented-proposals/staking-rewards.md) distributed to [Solana Validators](../src/running-validator.md). | ||
|
|
||
| ### Why burn some fees? | ||
|
|
||
| As mentioned above, a fixed proportion of each transaction fee is _burned_ (aka destroyed). The intent of this design is to retain leader incentive to include as many transactions as possible within the leader-slot time. While still providing an inflation limiting mechanism that protects against "tax evasion" attacks \(i.e. side-channel fee payments\). | ||
|
|
||
| Burnt fees can also help prevent malicious validators from censoring transactions by being considered in [fork](./terminology.md#fork) selection. | ||
|
|
||
| #### Example of an attack: | ||
|
|
||
| In the case of a [Proof of History (PoH)](./terminology.md#proof-of-history-poh) fork with a malicious, censoring leader: | ||
|
|
||
| - due to the fees lost from censoring, we would expect the total fees destroyed to be **_less than_** a comparable honest fork | ||
| - if the censoring leader is to compensate for these lost protocol fees, they would have to replace the burnt fees on their fork themselves | ||
| - thus potentially reducing the incentive to censor in the first place | ||
|
|
||
| ## Calculating transaction fees | ||
|
|
||
| Transactions fees are calculated based on two main parts: | ||
|
|
||
| - a statically set base fee per signature, and | ||
| - the computational resources used during the transaction, measured in "[_compute units_](./terminology.md#compute-units)" | ||
|
|
||
| Since each transaction may require a different amount of computational resources, they are alloted a maximum number of _compute units_ per transaction known as the "[_compute budget_](./terminology.md#compute-budget)". | ||
|
|
||
| The execution of each instruction within a transactions consumes a different number of _compute units_. After the maximum number of _computer units_ has been consumed (aka compute budget exhaustion), the runtime will halt the transaction and return an error. Resulting in a failed transaction. | ||
|
|
||
| Network consensus votes are sent as normal system transfers, which means that validators pay transaction fees to participate in consensus. | ||
| > **Learn more:** compute units and the [Compute Budget](./developing/programming-model/runtime#compute-budget) in the Runtime and [requesting a fee estimate](./developing/clients/jsonrpc-api.md#getfeeformessage) from the RPC. | ||
|
|
||
| Many current blockchain economies \(e.g. Bitcoin, Ethereum\), rely on protocol-based rewards to support the economy in the short term, with the assumption that the revenue generated through transaction fees will support the economy in the long term, when the protocol derived rewards expire. In an attempt to create a sustainable economy through protocol-based rewards and transaction fees, a fixed portion (initially 50%) of each transaction fee is destroyed, with the remaining fee going to the current leader processing the transaction. A scheduled global inflation rate provides a source for rewards distributed to validation-clients, through the process described above. | ||
| ## Prioritization fee | ||
|
|
||
| Transaction fees are set by the network cluster based on recent historical throughput, see [Congestion Driven Fees](implemented-proposals/transaction-fees.md#congestion-driven-fees). This minimum portion of each transaction fee can be dynamically adjusted depending on historical _signatures-per-slot_. In this way, the protocol can use the minimum fee to target a desired hardware utilization. By monitoring a protocol specified _signatures-per-slot_ with respect to a desired, target usage amount, the minimum fee can be raised/lowered which should, in turn, lower/raise the actual _signature-per-slot_ per block until it reaches the target amount. This adjustment process can be thought of as similar to the difficulty adjustment algorithm in the Bitcoin protocol, however in this case it is adjusting the minimum transaction fee to guide the transaction processing hardware usage to a desired level. | ||
| Recently, Solana has introduced an optional fee called the "_[prioritization fee](./terminology.md#prioritization-fee)_". This additional fee can be paid to help boost how a transaction is prioritized against others, resulting in faster transaction execution times. | ||
|
|
||
| As mentioned, a fixed-proportion of each transaction fee is to be destroyed. The intent of this design is to retain leader incentive to include as many transactions as possible within the leader-slot time, while providing an inflation limiting mechanism that protects against "tax evasion" attacks \(i.e. side-channel fee payments\). | ||
| The prioritization fee is calculated by multiplying the requested maximum _compute units_ by the compute-unit price (specified in increments of 0.000001 lamports per compute unit) rounded up to the nearest lamport. | ||
|
|
||
| Additionally, the burnt fees can be a consideration in fork selection. In the case of a PoH fork with a malicious, censoring leader, we would expect the total fees destroyed to be less than a comparable honest fork, due to the fees lost from censoring. If the censoring leader is to compensate for these lost protocol fees, they would have to replace the burnt fees on their fork themselves, thus potentially reducing the incentive to censor in the first place. | ||
| You can read more about the [compute budget instruction](./developing/programming-model/runtime.md#compute-budget) here. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's cleanup comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get rid of it? I left it in there since when that "what is rent" page gets added we can easily link back to it in the future. The page is written in the WIP PR #26816 but is waiting on the sidebar restructure to get complete to be published
If you want, I can remove it for now though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll remove later when the rent page is added