×
Array
(
[fid] => 6980
[description] =>
[password] =>
[icon] =>
[redirect] =>
[attachextensions] =>
[creditspolicy] => Array
(
[post] => Array
(
[usecustom] => 1
[cycletype] => 1
[cycletime] => 0
[rewardnum] => 75
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 1
[fid] => 6980
[rulename] => 发表主题
[action] => post
[fids] => 32,52,67,447,1120,1151,1156,6750,6762,6763,6766,6769,6772,6773,6787,6796,6808,6809,6810,6813,6814,6820,6829,6830,6846,6856,6864,6865,6827,6930,6931,6776,6858,6880,6764,6932,6871,6758,6905,1116,6788,6812,6798,6736,6759,6842,6966,6767,6828,6924,6935,6936,6938,6940,6941,6826,6909,6803,6919,6911,6908,6881,6920,6912,6913,6921,6925,6922,6789,6818,6819,6872,6928,6969,6889,6888,6917,6939,6947,6961,6937,6943,6970,6869,6900,6902,6783,6817,1111,6870,6821,6951,6876,6952,6954,6960,6942,6910,6949,6962,6963,6964,6927,6926,6973,6728,6929,6874,6894,6896,6885,6857,6868,1113,6778,56,6844,6878,6802,6933,6811,6923,6877,6875,6918,6892,6757,6832,6833,6795,6793,6848,6837,6849,6850,6851,6852,6853,6854,6863,6882,6836,6790,6838,6794,6791,6873,555,6895,6934,6958,6944,6945,6907,6779,6886,6950,6904,6956,6862,6957,6855,6955,6959,6914,6965,6971,6972,6953,6975,6976,6799,6974,6824,6815,6891,6866,6979,6977,6765,6903,6948,6845,6879,1121,6980
)
[reply] => Array
(
[usecustom] => 1
[cycletype] => 4
[cycletime] => 0
[rewardnum] => 0
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 2
[fid] => 6980
[rulename] => 发表回复
[action] => reply
)
[digest] => Array
(
[usecustom] => 1
[cycletype] => 4
[cycletime] => 0
[rewardnum] => 0
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 3
[fid] => 6980
[rulename] => 加精华
[action] => digest
)
)
[formulaperm] => a:5:{i:0;s:0:"";i:1;s:0:"";s:7:"message";s:0:"";s:5:"medal";N;s:5:"users";s:0:"";}
[moderators] =>
[rules] =>
[threadtypes] => Array
(
[status] => 1
[required] => 0
[listable] => 0
[types] => Array
(
)
)
[threadsorts] => Array
(
)
[viewperm] =>
[postperm] =>
[replyperm] =>
[getattachperm] =>
[postattachperm] =>
[postimageperm] =>
[spviewperm] =>
[seotitle] =>
[keywords] =>
[seodescription] =>
[supe_pushsetting] =>
[modrecommend] => Array
(
[open] => 0
[num] => 10
[imagenum] => 0
[imagewidth] => 300
[imageheight] => 250
[maxlength] => 0
[cachelife] => 0
[dateline] => 0
)
[threadplugin] => Array
(
)
[replybg] =>
[extra] => a:2:{s:9:"namecolor";s:0:"";s:9:"iconwidth";s:0:"";}
[jointype] => 0
[gviewperm] => 0
[membernum] => 0
[dateline] => 0
[lastupdate] => 0
[activity] => 0
[founderuid] => 0
[foundername] =>
[banner] =>
[groupnum] => 0
[commentitem] =>
[relatedgroup] =>
[picstyle] => 0
[widthauto] => 0
[noantitheft] => 0
[noforumhidewater] => 0
[noforumrecommend] => 0
[livetid] => 0
[price] => 0
[fup] => 6974
[type] => sub
[name] => 币圈资讯
[status] => 1
[displayorder] => 0
[styleid] => 0
[threads] => 50922
[posts] => 50990
[todayposts] => 0
[yesterdayposts] => 0
[rank] => 61
[oldrank] => 59
[lastpost] => 2688723 美国2024年大选已花费147亿美元,或为史上最贵 1730688420 比推快讯
[domain] =>
[allowsmilies] => 1
[allowhtml] => 1
[allowbbcode] => 1
[allowimgcode] => 1
[allowmediacode] => 0
[allowanonymous] => 0
[allowpostspecial] => 1
[allowspecialonly] => 0
[allowappend] => 0
[alloweditrules] => 0
[allowfeed] => 0
[allowside] => 0
[recyclebin] => 1
[modnewposts] => 0
[jammer] => 0
[disablewatermark] => 0
[inheritedmod] => 0
[autoclose] => 0
[forumcolumns] => 0
[catforumcolumns] => 0
[threadcaches] => 0
[alloweditpost] => 1
[simple] => 16
[modworks] => 0
[allowglobalstick] => 1
[level] => 0
[commoncredits] => 0
[archive] => 0
[recommend] => 0
[favtimes] => 0
[sharetimes] => 0
[disablethumb] => 0
[disablecollect] => 0
[ismoderator] => 0
[threadtableid] => 0
[allowreply] =>
[allowpost] =>
[allowpostattach] =>
)
探究对以太坊TPS造成影响的五个方面
[复制链接]
|
当前离线
经验:
天策币:
活跃币:
策小分:
总在线: 分钟
本月在线: 分钟
|
|
原文标题:《ETH 交易成本组成》 原文作者:Xiang,W3.Hitchhiker;修订:Evelyn,W3.Hitchhiker 众所周知,以太坊有自己的虚拟机。 什么意思呢? 就是比特币中的交易长这样: 「如果小明的签名验证通过,小明转 10 元钱给小红的地址。」 而以太坊中的交易可能长这样: 「当小明的签名验证通过并且满足 blablablabla 条件时,将小明账户中的 10 元钱转到小红的账户上。」 这其中的 blablablabla 条件,实际上可以是任何逻辑或者任何程序,其中可以有条件判断,可以有循环,这些以太坊都支持。但问题就来了——要是有个不善良的矿工打包了个死循环放在区块里,岂不是能让所有的以太坊节点都死机? 为了防止这种事情发生,以太坊中设置了每个区块的 Gas 上限以及每个计算步骤所需要消耗的 Gas 量。 我们可以简单粗暴地把 Gas 理解成汽油。比如,一个条件判断需要 10 gas,一个签名验证需要 100 gas,一个状态读写需要 10 gas 等等……然后,每笔交易都需要注明这笔交易需要使用的 Gas(当然,还需要付钱)。比如说,在某笔交易之后,你注明「跑 1000 个 gas 的」,于是,以太坊的节点会执行这笔交易,但是当计算需要消耗的 gas 超过 1000 了,不管交易的步骤执行没执行完都会停下来。 于是,死循环不会出现,比如你写了个死循环,但是每次循环会烧 10 gas,而区块的 gas 上限是 10000,你于是最多给这个程序买 10000 的 gas,那么所有节点会执行 1000 次循环,直到把你给的 gas 烧完就停下来,而不会无限循环下去。 而这个时候就引出了另一个以太坊和比特币不同的区别: 在比特币中,链上最宝贵的资源是空间——因为一个区块大小是 1 M,而平均 10 分钟才能出一个区块。 而在以太坊中,链上最宝贵的资源是 gas,因为每个区块的 gas 是有上限的,而平均出块时间也是固定的,每单位时间能够做的计算步骤其实也是有限的,所以 ETH 的 TPS 也是有限的。 于是,当大量的人需要做交易,尤其是很多操作复杂的交易的时候,以太坊就会拥堵。 ETH 的 TPS对 ETH 的 TPS 造成影响的问题大概分以下几个方面: ETH 的 gas 机制 ETH 的交易成本 ETH 的网络 合并进程 分片链
1、ETH 的 gas 机制我们知道比特币区块链中消耗的矿工费用是 BTC,为了激励以太坊网络中的计算,于是在以太坊中产生了 gas 的概念,在以太坊区块链上执行写入操作都需要支付 gas 费用,以太坊定义了货币是 1 ETH,且 1 ETH = 1e18 Wei。Wei 是其中的最小额,在整个工作中,发送Token、调用合约都要支付 gas,且以 Wei 作为单位来计算。 Wei 的由来戴维(Wei Dai)是一位华裔计算机工程师,对密码学和加密货币的贡献而闻名,他开发了 Crypto++ 密码库,创建了 B-Money 加密货币系统,并共同提出了 VMAC 消息认证码算法。2013 年,Vitalik Buterin 的以太坊(Ethereum)最小单位 Wei,便以他的名字命名。比特币白皮书的排名第一的参考资源也是戴维的 B-money,中本聪在建立比特币初期也多次想与戴维联系。 目前 ETH 消耗 gas 的单位是 Gwei,对应 1 Gwei=1e9 Wei 简单说,gas price 就是汽油单价,gas limit 相当于发动一次汽车需要的最大汽油量。 再具体点的表达是: Gas Price |
|
|
|
|
|
|