EGLD 转账(移动余额交易)
原文:https://docs.elrond.com/developers/gas-and-fees/egld-transfers
## 公式
对于 EGLD 转账,处理的实际气体成本易于精确确定,因为它仅包含值移动和数据处理组件。根据之前描述的公式,气体极限应设置为实际气体成本:
tx.gasLimit =
networkConfig.erd_min_gas_limit +
networkConfig.erd_gas_per_data_byte * lengthOf(tx.data)
例子
鉴于:
networkConfig.erd_min_gas_limit is 50000
networkConfig.erd_gas_per_data_byte is 1500
networkConfig.erd_min_gas_price is 1000000000
tx1.data = ""
tx1.gasPrice = networkConfig.erd_min_gas_price
tx2.data = "Hello world!"
tx2.gasPrice = networkConfig.erd_min_gas_price
然后:
tx1.gasLimit = 50000
tx2.gasLimit
= 50000 + 1500 * len("Hello world!")
= 68000
此外,费用如下:
fee(tx1)
= tx1.gasLimit * tx1.gasPrice
= 50000 * 1000000000
= 50000000000000 atoms of EGLD
= 0.00005 EGLD
fee(tx2)
= tx2.gasLimit * tx2.gasPrice
= 68000 * 1000000000
= 68000000000000 atoms of EGLD
= 0.000068 EGLD