概览
EIP-1559 通过将单一的 gas 价格拍卖模型替换为双费用结构,彻底改变了交易手续费机制。这为兼容 EVM 的链带来了更可预测的费用和更高的网络效率。核心概念
双费用结构
在 EIP-1559 之前,费用计算很简单:baseFee:由协议决定的每单位 gas 最低价格priorityTip:用于提升交易优先级的可选费用
Cosmos SDK 使用的术语与 Ethereum 不同。Ethereum 中的
gasLimit 在 Cosmos 中称为 gasWanted。由于 Cosmos EVM 连接了 Ethereum 与 Cosmos SDK 的概念,你会同时遇到这两个术语。基础费用机制
基础费用是交易被纳入区块所需的每单位 gas 最低价格。它会根据网络利用率在每个区块自动调整。调整公式
- 增加:当
gasUsed > gasTarget时(拥堵) - 降低:当
gasUsed < gasTarget时(利用不足) - 保持稳定:当
gasUsed == gasTarget时(最优)
计算示例
使用 Ethereum 的标准参数:- 当前基础费用:1000 单位
- 区块容量:10M gas
- 目标值(50%):5M gas
- 实际使用量:8M gas(使用率 80%)
- 分母:8
目标利用率
目标利用率决定了区块的最佳填充程度:ElasticityMultiplier = 2:50% 目标值(Ethereum 标准)ElasticityMultiplier = 4:25% 目标值(更激进的定价)ElasticityMultiplier = 1:100% 目标值(最大吞吐量)
优先小费与 MEV
max_priority_fee_per_gas(小费)用于激励验证者更快纳入交易。不过,在 Cosmos SDK 实现中:
- 与 Ethereum 相比,交易优先级机制更受限
- 小费对纳入顺序的影响可能很小
- MEV 机会通常会减少
有效 Gas 价格
对于 EIP-1559 交易,用户需要指定两个上限:maxFeePerGas:愿意支付的总最高价格maxPriorityFeePerGas:给验证者的小费上限
费用计算示例
低活动时期
- 基础费用:100 gwei
- 用户设置:maxFeePerGas = 200 gwei,maxPriorityFeePerGas = 2 gwei
- 有效价格:100 + 2 = 102 gwei
- 用户支付:102 gwei(远低于其 200 gwei 的上限)
高度拥堵
- 基础费用:180 gwei
- 用户设置:maxFeePerGas = 200 gwei,maxPriorityFeePerGas = 30 gwei
- 有效价格:min(180 + 30, 200) = 200 gwei
- 用户支付:200 gwei(受其最高上限限制)
最低 Gas 价格
费用市场会强制执行多个价格下限:本地与全局最低值
- 本地最低值:由各个验证者在节点配置中设置
- 全局最低值:通过治理设置为
MinGasPrice参数 - 基础费用:当前由协议计算出的最低值
EIP-1559 的优势
对用户
- 费用可预测:提交前即可知道基础费用
- 更好的用户体验:钱包可以更可靠地估算成本
- 更公平的定价:同一区块内所有用户支付的费率相近
- 防止过度支付:
MaxFeePerGas可限制最高支付金额
对网络
- 自动调整:无需人工干预
- 抗垃圾交易:动态费用可抑制攻击
- 最优利用率:引导区块高效使用
- 经济稳定性:费用收入更可预测
对开发者
- 估算更简单:基础费用由协议直接提供
- 工具支持更好:提供标准费用数据 API
- 行为更一致:适用于各类兼容 EVM 的链
常见误解
“小费总能加快交易速度”
在 Cosmos SDK 链中,交易排序通常在内存池内按 FIFO 进行,因此小费的效果往往不如 Ethereum 主网明显。“基础费用一定会被销毁”
虽然 Ethereum 会销毁基础费用,但 Cosmos EVM 链可能会根据自身经济模型采用不同的分配方式。“EIP-1559 消除了费用激增”
它能平滑波动,但无法阻止极端拥堵时的价格飙升。调整速率本身就是有意受限的。延伸阅读
Overview
EIP-1559 revolutionizes transaction fee mechanics by replacing the single gas price auction model with a dual-fee structure. This creates more predictable fees and improved network efficiency for EVM-compatible chains.Core Concepts
Dual-Fee Structure
Before EIP-1559, fees were simple:baseFee: Protocol-determined minimum price per gas unitpriorityTip: Optional fee for transaction prioritization
The Cosmos SDK uses different terminology than Ethereum. What Ethereum calls
gasLimit is gasWanted in Cosmos. You’ll encounter both terms in the Cosmos EVM as it bridges Ethereum and Cosmos SDK concepts.Base Fee Mechanism
The base fee is the minimum price per unit of gas required for transaction inclusion. It automatically adjusts each block based on network utilization.Adjustment Formula
- Increases when
gasUsed > gasTarget(congested) - Decreases when
gasUsed < gasTarget(underutilized) - Remains stable when
gasUsed == gasTarget(optimal)
Example Calculation
With standard Ethereum parameters:- Current base fee: 1000 units
- Block capacity: 10M gas
- Target (50%): 5M gas
- Actual usage: 8M gas (80% full)
- Denominator: 8
Target Utilization
The target utilization determines the optimal block fullness:ElasticityMultiplier = 2: 50% target (Ethereum standard)ElasticityMultiplier = 4: 25% target (aggressive pricing)ElasticityMultiplier = 1: 100% target (maximum throughput)
Priority Tips and MEV
Themax_priority_fee_per_gas (tip) serves as an incentive for validators to include transactions faster. However, in Cosmos SDK implementations:
- Transaction prioritization is limited compared to Ethereum
- Tips may have minimal effect on inclusion order
- MEV opportunities are generally reduced
Effective Gas Price
For EIP-1559 transactions, users specify two limits:maxFeePerGas: Maximum total they’re willing to paymaxPriorityFeePerGas: Maximum tip for validators
Fee Calculation Examples
Low Activity Period
- Base fee: 100 gwei
- User sets: maxFeePerGas = 200 gwei, maxPriorityFeePerGas = 2 gwei
- Effective price: 100 + 2 = 102 gwei
- User pays: 102 gwei (well below their 200 gwei max)
High Congestion
- Base fee: 180 gwei
- User sets: maxFeePerGas = 200 gwei, maxPriorityFeePerGas = 30 gwei
- Effective price: min(180 + 30, 200) = 200 gwei
- User pays: 200 gwei (capped at their maximum)
Minimum Gas Prices
The fee market enforces multiple price floors:Local vs. Global Minimums
- Local minimum: Set by individual validators in node configuration
- Global minimum: Set as the
MinGasPriceparameter via governance - Base fee: Current protocol-calculated minimum
Benefits of EIP-1559
For Users
- Predictable fees: Base fee is known before submitting
- Better UX: Wallets can reliably estimate costs
- Fair pricing: All users in a block pay similar rates
- Protection: MaxFeePerGas prevents overpayment
For Networks
- Automatic adjustment: No manual intervention needed
- Spam resistance: Dynamic fees deter attacks
- Optimal utilization: Targets efficient block usage
- Economic stability: Predictable fee revenue
For Developers
- Simplified estimation: Base fee is protocol-provided
- Better tools: Standard APIs for fee data
- Consistent behavior: Across EVM-compatible chains