From 54f230eb9ba6b698df8e37582e7dddaaa6e208f1 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Mon, 18 Nov 2024 21:52:05 +0800 Subject: [PATCH] update zero-fee document --- content/tutorials/consumptional-fee.md | 66 ---------------- content/tutorials/zero-fee-transactios.md | 96 +++++++++++++++++++++++ 2 files changed, 96 insertions(+), 66 deletions(-) delete mode 100644 content/tutorials/consumptional-fee.md create mode 100644 content/tutorials/zero-fee-transactios.md diff --git a/content/tutorials/consumptional-fee.md b/content/tutorials/consumptional-fee.md deleted file mode 100644 index aa5ae27..0000000 --- a/content/tutorials/consumptional-fee.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: How to Enable Consumptional Fee? -weight: 10 ---- - -## Preface - -The blockchain ecosystem is continuously evolving, with new models and protocols emerging to address specific needs -and challenges. One of these is [PIP-31](https://pips.pactus.org/PIPs/pip-31), the "Consumptional Fee Model," a -unique approach to transaction fees within the Pactus blockchain network. -Traditional fee models often impose fixed charges, potentially excluding lower-priority or low-fee transactions from -timely processing. This can create barriers for users who prefer economical transactions over speed, particularly -within decentralized environments where inclusion is a priority. - -This tutorial explores the foundation of the Consumptional Fee Model, designed to provide a balanced and flexible -fee structure based on data consumption. This model allows users to benefit from a zero or low-fee option, albeit -with trade-offs in transaction confirmation speed. -The approach aims to incentivize efficient data usage while giving validators the flexibility to configure fees -dynamically based on network demands and user transaction patterns. - -## Configuring the Consumptional Fee - -By default, the consumptional fee is disabled in the [configuration](https://github.com/pactus-project/pactus/blob/main/config/example_config.toml). - -```toml - # `tx_pool.fee` contains configuration to calculate the transaction fee. - [tx_pool.fee] - - # The `fixed_fee` is a constant fee applied to each transaction, regardless of its size or type. - # Default is `0.01` PAC. - fixed_fee = 0.01 - - # The `daily_limit` is the number of bytes an account can send each day without paying a fee. - # The `daily_limit` is part of the consumptional fee model. - # To understand how the consumptional fee model works, you can refer to - # PIP-31: Consumptional Fee Mode (https://pips.pactus.org/PIPs/pip-31) - # Default is `360` bytes. - daily_limit = 360 - - # The `unit_price` defines the fee per byte in PAC. - # The `unit_price` is part of the consumptional fee model. - # If it is zero, the consumptional fee will be ignored. - # To understand how the consumptional fee model works, you can refer to - # PIP-31: Consumptional Fee Mode (https://pips.pactus.org/PIPs/pip-31) - # Default is `0.0` PAC. - unit_price = 0.0 -``` - -{{< callout type="info" >}} -When the consumptional fee model is enabled, each signer can have **1~2 zero-fee** transactions per day. -{{< /callout >}} - -This configuration is recommended for enabling the consumptional fee, though you can adjust -`daily_limit` and `unit_price` as needed. - -- `daily_limit` = the daily limit is the number of bytes an account can send each day without paying a fee. -- `unit_price` = the fee per byte of data - -```toml - [tx_pool.fee] - fixed_fee = 0.0 - daily_limit = 360 - unit_price = 0.000005 -``` - -After updating your node configuration, you will need to restart your node to enable the consumptional fee. diff --git a/content/tutorials/zero-fee-transactios.md b/content/tutorials/zero-fee-transactios.md new file mode 100644 index 0000000..ad99707 --- /dev/null +++ b/content/tutorials/zero-fee-transactios.md @@ -0,0 +1,96 @@ +--- +title: How to Send Zero-Fee Transactions? +weight: 10 +--- + +## Preface + +Pactus supports zero-fee transactions starting from +[Version 1.6.0 (Mumbai)](https://pactus.org/2024/11/14/pactus-1.6.0-mumbai-released/). +However, for security reasons, there are restrictions on zero-fee transactions: + +- Each address can send approximately two zero-fee transactions daily. +- Zero-fee transactions have longer confirmation times. + +## How Does It Work? + +Zero-fee transactions are based on the consumption-based fee model +detailed in [PIP-31](https://pips.pactus.org/PIPs/pip-31). + +According to the Consumptional Fee model, each address has a daily limit for sending zero-fee transactions. +This limit is measured in bytes and decreases whenever a transaction from the address +is broadcast to the network or confirmed in a block. +By default, each address is allowed 360 bytes of zero-fee transactions daily. + +It is important to note that the fee configuration in Pactus is not deterministic. +Each validator sets its own preferences for accepting transactions, which means: + +1. A validator first checks whether the transaction's fee meets its minimum requirements. +2. If the fee is sufficient, the transaction is added to the transaction pool and + processed when a validator proposes a new block. +3. If the fee is below the threshold, the validator ignores it but + broadcasts the transaction to other validators, who may or may not accept it. + +This approach makes it impossible to guarantee that a transaction with will be accepted by the network. +Users can monitor their transactions on the [Fee Tracker](https://pacviewer.com/fee) page in PacViewer. +This page displays unconfirmed transactions in the pool and +allows users to check whether their transaction is confirmed or not. + +Please note that every transaction in Pactus has a lifetime of one day. +If a transaction is not included in a block within one day, it will be invalidated. + +## How to Send Zero-Fee Transactions? + +By default, the transaction fee is set to `0.01` PAC. To send a zero-fee transaction: + +- **In the GUI**: Set the fee to `0` PAC. +- **In the Command Line**: Use the `--fee 0` option. + +## How to Accept Zero-Fee Transactions? + +By default, the consumptional fee is disabled in the +[configuration file](https://github.com/pactus-project/pactus/blob/main/config/example_config.toml). +If your validator node has sufficient resources, +you can update the configuration to accept and process zero-fee transactions: + +1. Increase the transaction pool size to accommodate more transactions. +2. Set `fixed_fee` to `0` to accept transactions with zero fee. +3. Adjust the `daily_limit` and `unit_price` as needed. The recommended settings are: + - `daily_limit`: 360 bytes + - `unit_price`: 0.000005 PAC per byte + +Here is an example configuration for accepting zero-fee transactions: + +```toml +# `tx_pool` contains configuration options for the transaction pool module. +[tx_pool] + + # `max_size` indicates the maximum number of unconfirmed transactions inside the pool. + # Default is `1000`. + max_size = 5000 + + # `tx_pool.fee` contains configuration to calculate the transaction fee. + [tx_pool.fee] + + # The `fixed_fee` is a constant fee in PAC that applies to each transaction, regardless of its size or type. + # Default is `0.01` PAC. + fixed_fee = 0.00 + + # The `daily_limit` is the number of bytes an account can send each day without paying a fee. + # The `daily_limit` is part of the consumptional fee model. + # To understand how the consumptional fee model works, you can refer to + # PIP-31: Consumptional Fee Mode (https://pips.pactus.org/PIPs/pip-31) + # Default is `360` bytes. + daily_limit = 360 + + # The `unit_price` defines the fee per byte in PAC. + # The `unit_price` is part of the consumptional fee model. + # If it is zero, the consumptional fee will be ignored. + # To understand how the consumptional fee model works, you can refer to + # PIP-31: Consumptional Fee Mode (https://pips.pactus.org/PIPs/pip-31) + # Default is `0.0` PAC. + unit_price = 0.000005 + +``` + +After updating the configuration, restart your node to enable the consumptional fee model.