Fee Model
Fee Model - Transaction Fees and Economics
This document describes the fee model, fee calculation, and economic incentives in the Roru Protocol.
Fee Structure
Fee Components
Fee Types:
Base Fee: Fixed fee per transaction
Size Fee: Fee based on transaction size
Priority Fee: Optional priority fee
Network Fee: Chain-specific network fees
Fee Format:
pub struct TransactionFees {
pub base_fee: u64,
pub size_fee: u64,
pub priority_fee: Option<u64>,
pub network_fee: u64,
pub total: u64,
}Fee Calculation
Base Fee
Base Fee Calculation:
Size Fee
Size Fee Calculation:
Priority Fee
Priority Fee Calculation:
Network Fee
Network Fee Calculation:
Total Fee Calculation
Calculation Process
Total Fee:
Fee Payment
Payment Methods
Payment Options:
Dedicated Fee Note: Separate note for fees
Change Output: Fees from change
Public Fee: Public fee payment
Asset-Specific: Pay in specific asset
Fee Note Creation
Fee Note:
Economic Model
Fee Distribution
Distribution:
Infrastructure providers
Prover nodes
Relayer nodes
Protocol treasury (optional)
Distribution Code:
Dynamic Fee Adjustment
Fee Adjustment
Adjustment Factors:
Network congestion
Demand
Supply
Historical data
Adjustment Algorithm:
Fee Estimation
Estimation Process
Estimation Steps:
Estimate transaction size
Get current network fees
Calculate base fees
Apply priority
Return estimate
Estimation Code:
Fee Optimization
Optimization Strategies
Strategies:
Batch transactions
Optimize transaction size
Choose optimal priority
Time transactions
Batch Optimization
Batch Fees:
Fee Refunds
Refund Scenarios
Refund Cases:
Transaction failure
Network errors
Invalid transactions
Timeout
Refund Process:
Fee Transparency
Fee Display
Display Format:
Breakdown by component
Total fee
Fee in different units
Historical comparison
Fee Reporting
Reporting:
Per-transaction fees
Aggregate fees
Fee trends
Cost analysis
Conclusion
The fee model provides:
Fairness: Transparent fee structure
Efficiency: Optimized fees
Flexibility: Multiple payment methods
Economics: Sustainable model
Transparency: Clear fee breakdown
Understanding fees is essential for economic analysis.
Last updated
