tezos-client如何计算交易费用?
-
-
您也可以看看这个https://tezos.stackexchange.com/q/106/118You can also have a look at this one https://tezos.stackexchange.com/q/106/118
- 0
- 2019-02-14
- Ezy
-
1 个回答
- 投票数
-
- 2019-02-14
费用计算遵循公式.
这里唯一的微妙之处是费用本身会影响二进制操作的大小.通常这并不重要,但是为了处理一般情况,客户端当前会循环:
- 开始与费集运草案为零(其gas_limit和storage_limit适当地选择).
- 以二进制形式衡量运营规模,并根据公式计算所需费用. (如果这是批次中的第一个/唯一操作,请添加在这里也为一批操作固定了开销.
- 如果手术中的费用足够大,我们就完成了.否则,请在操作中更新费用,然后转到#2.
这发生在patch_fee中.毫升.
The fee computation follows the formula.
The only subtle thing here is that the fee itself can affect the size of the operation in binary. This usually doesn't matter, but to handle the general case, the client currently loops:
- Start with the draft op with fee set to zero (with its gas_limit and storage_limit chosen appropriately).
- Measure the op size in binary and compute the required fee according to the formula. (If this is the first/only op in a batch, add the fixed overhead for a batch of operations here too.)
- If the fee in the op is big enough, we're done. Otherwise, update the fee in the op, and go to #2.
This happens in patch_fee in injection.ml.
-
我不确定它是否使用此代码.相反,我认为它通过RPC调用该节点,这在我的回复引用的博客文章中得到了解释.I am not sure it uses this code. Instead, I think it calls the node through RPCs, this is explained in the blog post cited by my reply.
- 0
- 2019-02-14
- lefessan
-
RPC确实可以用来估计天然气和存储的使用量,等等,但是没有RPC可以用来计算最低费用.我链接的代码被使用.RPCs are indeed used to estimate gas and storage usage, and more, but there is no RPC for calculating the minimum fee. The code I linked is used.
- 0
- 2019-02-14
- Tom
-
(要了解这种情况的发生,请尝试在不指定费用的情况下尝试使用"tezos-client -l",如博客文章中所示.您会注意到,`run_operation`的调用费用为0,然后神秘地以正确的方式调用了"preapply"最低费用,尚未由任何RPC返回,但由客户端在`run_operation`之后计算得出.)(To see this happening, try `tezos-client -l` without specifying a fee, as in the blog post. You will notice that the `run_operation` is called with 0 fee, and then `preapply` is mysteriously called with the correct minimal fee, not returned yet by any RPC, but calculated by the client after `run_operation`.)
- 1
- 2019-02-14
- Tom
-
哦,是的,我以为是煤气和燃烧.我将删除答案.Oh yes, I thought it was about gas and burn. I will delete my answer.
- 0
- 2019-02-14
- lefessan
在运行诸如
tezos-client transfer 1 from alice to bob
的转账之类的交易时,客户端如何计算交易费用?