Skip to content

Commit d11470d

Browse files
authored
docs/add fees summary (#214)
1 parent 0529c96 commit d11470d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docs/operators/FEES.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Kora Fee Estimation Resource Guide
2+
3+
*Last updated: 2025-09-02*
4+
5+
Kora estimates transaction fees when performing `estimate_transaction_fee` and `sign_transaction_if_paid` RPC methods. To estimate fees, Kora calculates the total cost for executing transactions on Solana, including network fees, account creation costs, and optional payment processing fees. This guide breaks down each component of the fee calculation.
6+
7+
## Fee Calculation Formula
8+
9+
The main entry point for fee estimation is `FeeConfigUtil::estimate_kora_fee()` in [`crates/lib/src/fee/fee.rs`](/crates/lib/src/fee/fee.rs). It uses the following generalized formula:
10+
11+
```
12+
Total Fee = Base Fee
13+
+ Account Creation Fee
14+
+ Kora Signature Fee
15+
+ Fee Payer Outflow
16+
+ Payment Instruction Fee
17+
+ Transfer Fee Amount
18+
+ Price Adjustment (if configured)
19+
```
20+
21+
## Fee Components
22+
23+
| Component | Description | Calculation Method | When Applied |
24+
|-----------|-------------|-------------------|--------------|
25+
| **Base Fee** | Core Solana transaction fee covering signature verification and transaction processing | `RpcClient.get_fee_for_message()` - Uses Solana's fee calculation based on compute units and priority fees | Always |
26+
| **Account Creation Fee** | Rent-exempt minimum balance for creating new Associated Token Accounts (ATAs) | `Rent::default().minimum_balance(account_size)` - Calculates rent based on account data size (165-355 bytes depending on token extensions) | When transaction creates new ATAs |
27+
| **Kora Signature Fee** | Additional fee when Kora signs as a non-participant fee payer | Fixed: 5,000 lamports (`LAMPORTS_PER_SIGNATURE`) | When fee payer is not already a transaction signer |
28+
| **Fee Payer Outflow** | Total SOL the fee payer sends out in the transaction (transfers, account creations, etc.) | Sum of: System transfers from fee payer, CreateAccount funded by fee payer, Nonce withdrawals from fee payer | When fee payer performs System Program operations |
29+
| **Payment Instruction Fee** | Estimated cost of priority fees to add a payment instruction for gasless transactions | Fixed estimate: 50 lamports (`ESTIMATED_LAMPORTS_FOR_PAYMENT_INSTRUCTION`) | When payment is required but not included in transaction |
30+
| **Transfer Fee** | Token2022 transfer fees configured on the mint (e.g., 1% of transfer amount) | `Token2022Mint.calculate_transfer_fee(amount, epoch)` - Based on mint's transfer fee configuration | Only for Token2022 transfers to Kora payment address |
31+
| **Price Adjustment** | Kora's pricing model markup/adjustment | Configured price model in `validation.price` - Can add markup or fixed fee amount | When `[validation.price]` is provided in kora.toml (optional) |

docs/operators/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Kora Node Operator Guide
2-
*Last Updated: 2025-08-25*
2+
*Last Updated: 2025-09-02*
33

44
## What is a Kora Node Operator?
55

@@ -58,6 +58,8 @@ Maintain sufficient SOL to cover network fees for your expected transaction volu
5858
- **Automation**: Implement automatic SOL top-up procedures for production environments
5959
- **Capacity planning**: Plan for expected use case, user volume, etc.
6060

61+
It is important that you understand how Kora estimates fees and how to configure your node to maximize your revenue. See the [Fee Estimation Guide](./FEES.md) for more details.
62+
6163
### 4. Monitor Operations
6264
Continuously track your node's security, performance, and business metrics:
6365
- **Security monitoring**: Unusual patterns, failed validations, and rate limit breaches

0 commit comments

Comments
 (0)