Gas 资费参考
Stable 的交易构建、gas 估算和工具配置。
交易构建
在 Stable 上构建交易时,将 maxPriorityFeePerGas 设置为 0。客户端应从最新块中获取最新的基本费用,并在计算 maxFeePerGas 时包含安全边际。
// ethers.js v6
const block = await provider.getBlock("latest");
const baseFee = block.baseFeePerGas;
const maxPriorityFeePerGas = 0n; // always 0 on Stable
const maxFeePerGas = baseFee * 2n + maxPriorityFeePerGas; // double the base fee as safety margin
const tx = await wallet.sendTransaction({
to: "0xRecipientAddress",
value: parseEther("0.01"),
maxFeePerGas,
maxPriorityFeePerGas,
});原生 USDT0 转账已确认。当 baseFee = 1 gwei 时,费用 ≈ 0.0000021 USDT0。Gas 估算
像在以太坊上一样使用 eth_estimateGas 和 eth_gasPrice。关键区别在于 eth_maxPriorityFeePerGas 将始终返回 0。
const gasPrice = await provider.send("eth_gasPrice", []);
const gasEstimate = await provider.estimateGas({
to: contractAddress,
data: callData,
});
const estimatedFeeInUSDT0 = gasPrice * gasEstimate;工具配置
- Hardhat / Foundry:无需特殊配置;标准 EVM 设置即可。如果您的配置明确设置了优先费用,请将其设置为
0。 - 钱包:隐藏或禁用优先小费输入字段。显示它可能会混淆用户,因为该值无效。
- 监控:费用分析仪表板不应跟踪优先费用。它们将始终为零。
下一步建议
- Gas 资费概念:了解 Stable 为何使用单组件费用模型。
- 以太坊比较:查看从以太坊移植时会遇到的所有行为差异。
- JSON-RPC API:参考 Stable 公开的
eth_*方法。

