在以太坊上有个专门的函数来计算矿工费`web3.eth.estimateGas`,这样在调用合约前可以有效地设置gas的上限,矿工费等于 gas * gasPrice。那么, 波场上如何计算矿工费呢? 查了波场的手册半天,没有查到`estimateGas`这个类似的函数,也就是说,在调用合约前是没办法计算出要消耗多少能量的。只有调用后在tronscan上查交易记录才能得出!这多少有点事后诸葛亮的意思。  以nutbox中的withdrawPeanuts()为例,这步调用消耗了88236个能量。  https://tronscan.org/#/proposals 在超级节点的提案中`1 ENERGY的费用为 0.00014 TRX`。计算下:矿工费等于 能量 * 能量价格 = 88236*0.00014 = 12.35304 trx, 和tronscan中的一致! 在波场中计算矿工费只能调用后才能知道,不知这算不算是个坑点呢!
author | lemooljiang |
---|---|
permlink | 5ovmxr-40 |
category | hive-105017 |
json_metadata | {"tags":["smartcontract","cn","gas","energy","tron"],"image":["https://steemjiang.com:8081/ipfs/QmRvFMCFUV4Ge7NsaRbFCs16ia4Gf61nyEWmZmCjCFX5xL","https://steemjiang.com:8081/ipfs/QmUxRN2auV9oMFWg2C3zx37Agx2BWNEUxisFGW8HoE5Xis"],"links":["https://tronscan.org/#/proposals"],"app":"hiveblog/0.1","format":"markdown","description":"在波场中计算矿工费只能调用后才能知道,不知这算不算是个坑点呢!","author":"lemooljiang"} |
created | 2021-03-01 12:33:27 |
last_update | 2021-03-01 12:33:27 |
depth | 0 |
children | 0 |
last_payout | 2021-03-08 12:33:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 3.710 HBD |
curator_payout_value | 3.431 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 616 |
author_reputation | 438,608,506,193,732 |
root_title | "波场上如何计算矿工费 / 学习智能合约#40" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 102,126,015 |
net_rshares | 16,763,092,436,657 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
ace108 | 0 | 719,379,592,451 | 26% | ||
rivalhw | 0 | 2,635,853,877,143 | 100% | ||
nextgen622 | 0 | 1,358,583,182,268 | 100% | ||
sweetsssj | 0 | 10,613,650,495,137 | 33% | ||
dapeng | 0 | 42,890,704,129 | 100% | ||
laodr | 0 | 3,611,059,731 | 100% | ||
htliao | 0 | 13,945,917,301 | 35% | ||
alphacore | 0 | 17,273,583,656 | 2.51% | ||
catwomanteresa | 0 | 182,261,559,529 | 50% | ||
liangfengyouren | 0 | 3,426,718,508 | 50% | ||
stevenmosoes | 0 | 544,997,212 | 50% | ||
aafeng | 0 | 230,013,609,622 | 30% | ||
cn-reader | 0 | 16,197,108,314 | 50% | ||
tvb | 0 | 39,957,556,877 | 50% | ||
karja | 0 | 229,360,319,632 | 10% | ||
kimzwarch | 0 | 10,926,401,260 | 4% | ||
yellowbird | 0 | 10,558,365,906 | 100% | ||
dancingapple | 0 | 12,132,311,723 | 50% | ||
blc | 0 | 4,016,625,937 | 100% | ||
hqy | 0 | 51,925,379,181 | 100% | ||
new-world-steem | 0 | 26,691,868,237 | 23% | ||
lebin | 0 | 3,603,365,625 | 100% | ||
fun2learn | 0 | 1,584,639,593 | 3% | ||
kymio | 0 | 523,414,373 | 3.75% | ||
competeapp | 0 | 1,123,553,821 | 100% | ||
archisteem | 0 | 1,238,725,871 | 7.5% | ||
moneybaby | 0 | 937,082,071 | 2.5% | ||
julian2013 | 0 | 77,079,875,950 | 50% | ||
pet.society | 0 | 25,115,547,658 | 6% | ||
tagalong | 0 | 716,572,333 | 100% | ||
ctime | 0 | 335,020,581,213 | 4% | ||
kggymlife | 0 | 1,426,408,686 | 5% | ||
btscn | 0 | 61,597,858,798 | 100% | ||
bilpcoinrecords | 0 | 846,447,977 | 16.5% | ||
hivecur2 | 0 | 731,696,579 | 5% | ||
intacto | 0 | 28,345,432,355 | 2% |