Key Features
Stablecoin Gas Payments
Unlike traditional blockchains that require native tokens for gas, Tempo accepts any USD-denominated TIP-20 token as a fee payment method. Users can pay fees in:- pathUSD (
0x20C0000000000000000000000000000000000000) - Tempo’s native stablecoin - USDC, USDT, or any other USD-denominated TIP-20 token
- Any token the validator accepts (determined by Fee AMM liquidity)
Target Cost Model
Tempo’s gas pricing targets predictable dollar costs for common operations:| Operation | Target Cost | Gas Amount |
|---|---|---|
| TIP-20 transfer (existing address) | $0.0001 (0.1 cents) | 50,000 gas |
| TIP-20 transfer (new address) | $0.0006 (0.6 cents) | 300,000 gas |
| Account creation (first use) | $0.0005 (0.5 cents) | 250,000 gas |
| Contract deployment (1 KB) | $0.035 (3.5 cents) | 1,750,000 gas |
Economic UnitsTempo uses precise economic units for fee accounting:
- Microdollars (μUSD): TIP-20 token units at 10⁻⁶ USD precision (6 decimals)
- Attodollars (aUSD): Gas pricing units at 10⁻¹⁸ USD precision
Automatic Fee Conversion
When a user’s preferred fee token differs from the validator’s preferred token, the Fee AMM automatically converts between them:Fee Collection Flow
1. Transaction Validation
When a transaction enters the mempool, the protocol:- Resolves the user’s fee token preference
- Calculates the maximum fee amount:
maxFee = gasLimit × baseFee - Checks if the user has sufficient balance
- If conversion is needed, verifies Fee AMM has sufficient liquidity
2. Pre-Transaction Collection
Before executing the transaction, the protocol callscollectFeePreTx on the FeeManager:
- Transfers
maxAmountofuserTokenfrom the user to the FeeManager - If conversion is needed, verifies sufficient AMM liquidity
- Temporarily holds the tokens in the FeeManager
FeeManager.sol:38 for implementation.
3. Transaction Execution
The transaction executes normally, consuming gas based on the operations performed.4. Post-Transaction Settlement
After execution, the protocol callscollectFeePostTx:
- Calculates the refund:
refund = maxAmount - actualUsed - Returns excess tokens to the user
- Converts
actualUsedtokens via the Fee AMM (if needed) - Credits the validator with converted tokens
FeeManager.sol:62 for implementation.
5. Validator Distribution
Validators can withdraw their collected fees at any time:FeeManager.sol:100 for implementation.
Fee Token Selection
User Preference
Users specify their fee token preference by calling:Validator Preference
Validators specify which token they want to receive fees in:Default Token
If no preference is set:- Users default to pathUSD (
0x20C0000000000000000000000000000000000000) - Validators default to pathUSD
Fee AMM Liquidity
For fee conversion to work, the Fee AMM must have sufficient liquidity in the relevant trading pair:- Pool structure: Directional pools for each
(userToken → validatorToken)pair - Liquidity provision: Single-sided deposits (validator token only)
- Rebalancing: Market participants can arbitrage via
rebalanceSwap
Gas Price Discovery
Tempo uses an EIP-1559-style base fee mechanism with stablecoin denomination:- Base fee: Dynamically adjusts based on block fullness
- Target: 50% block utilization
- Floor: Minimum base fee prevents spam attacks
State Creation Costs
Tempo significantly increases gas costs for state-creating operations to prevent spam attacks:| Operation | Standard Cost | Rationale |
|---|---|---|
| New storage slot (SSTORE 0→nonzero) | 250,000 gas | Prevents state bloat attacks |
| Account creation (first nonce write) | 250,000 gas | Economic deterrent for mass account creation |
| Contract code (per byte) | 1,000 gas | Linear pricing for code storage |
| Contract creation overhead | 500,000 gas | Covers metadata storage (keccak, codesize) |
Fee Token Introspection
Smart contracts can query which fee token is being used for the current transaction:- Adjusting pricing based on the fee token
- Routing decisions that consider fee costs
- Logging fee token for off-chain indexing
Next Steps
Gas Pricing
Learn about attodollar denomination and base fee dynamics
Fee AMM
Understand automatic stablecoin conversion mechanics
Stablecoin Fees
Guide to paying gas in USD stablecoins
TIP-1000
State creation cost specification