以太坊共识算法是什么?ETH使用的共识协议介绍

访客 阅读:19 2024-06-21 14:20:10 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

以太坊作为目前全球数字货币排行榜第二的存在,相信大多数投资者都对以太坊有一定的了解,不过这些了解大多数处于最基础的,比如说以太坊价格、发展历史、创始人等等,要说到以太坊共识算法,可以说是一脸蒙圈,目前共识算法比较常见并不多,而以太坊属于其中哪种呢,绝大多数投资者都不知道,那么,以太坊共识算法是什么呢?下面币圈子小编就给大家详细说说以太坊共识算法是什么?

It is believed that most investors have some understanding of Ether as the second highest ranking in the current global digital currency, but most of them are at the bottom, such as Ether’s prices, development history, founders, etc., and to speak of the Ether’s consensus algorithm, which is less common at present, but which of them is not known to the majority of investors, what is the Taifu’s consensus algorithm? What is it?

以太坊中设计了一套基于POW的Ethash共识算法。以太坊中共识设计的主要思想是设计一大一小的2个数据集,初始大小是:小:16M的cache 大:1G的dataset(DAG)

An Ethash consensus algorithm based on Pow has been designed in Ethash. The main idea of Ethash is to design two large and small data sets with the initial size: small: 16M cache large: 1G datasset (DAG)

设计一大一小的目的是:大的数据集是小的cahce通过计算生成的,矿工为了能更快的挖矿只能保存大的dataset,以免重复计算耽误时间,而轻节点只需保存保存小的cache即可验证。

The purpose of a large and small design is that large data sets are calculated by the small Cahce, that miners can only save large dataset for faster mining to avoid double counting of time, and that light nodes can only be verified by saving small cache.

大小数据集的生成原理

Generating principles for data sets of sizes

以太坊共识算法是什么?ETH使用的共识协议介绍

1.小cache:

1. Little cache:

初始大小为16M,容量大小以后每30000个区块会更改一次。

The initial size is 16M and the volume size will change once every 30,000 blocks.

通过Seed种子进行一些运算得到第一个数,之后在小cache中的每个数都是前一个数取哈希后得到的,一般轻节点存储此小cache。

The first number was obtained through some operation of the Seed seeds, and each number in the smaller cache was obtained after the previous number was taken, and the small cache is normally stored at light nodes.

2.大DAG:

2. Big DAG:

大的数据集中的元素都是通过小的cahe计算得到的,小cache中通过伪随机顺序先得到一个位置的元素A的值,再通过A计算哈希得到B位置的值,循环迭代256次后得到了大数据集中的第一个元素,依次类推直到得到全部的DAG元素。

The elements of the large data concentration are calculated by the small cahe, where the value of element A of a location is obtained first by pseudo-random sequence, then the value of a position of B is calculated by Hashi, and the first element of the large data concentration is obtained by recycled 256 times, and then by analogy until the total DAG element is obtained.

3.挖矿过程

3. Mining process

在以太坊中挖矿成功的条件跟比特币一样,找到一个nonce值,需要满足H(header) <=target.

Finds a nonce value on the same terms as Bitcoin for success in mining in the Taiku and needs to satisfy H(header) & lt;=target.

尝试一个随机数nonce时,在大的DAG中,通过header及nonce计算出一个初始的哈希值映射到初始位置A,然后读取A位置元素和A的相邻后一个位置A'的元素,再通过(A和A')计算出位置(B和B'),依次类推,迭代64次后,一共读取出128个数,最后计算这128个数的哈希值与目标值target比较,若满足<=target,则挖矿成功;否则重新尝试nonce。如下图所示:

When trying a random number of nónce, in the larger DAG, an initial Hashi value map is calculated by the header and nónce to the initial position A, then reading the A position element and the A adjacent position A#39; the elements are then calculated by (A and A #39;) the position (B and B & #39;) is calculated (B & B #39;) by analogy, after 64 turns, a total of 128 numbers are read out, and the 128 Hashi value is calculated in comparison with the target value Target, if & lt; = Target is met, the mine is successfully excavated; otherwise noce is tried again, as shown in the following graph:

以太坊共识算法是什么?ETH使用的共识协议介绍

整体的挖矿过程如下图所示:

The overall mining process is illustrated in the following graphs:

以太坊共识算法是什么?ETH使用的共识协议介绍

4.验证过程

4. Certification process

验证过程跟比特币类似,给定一个nonce值,只需验证一次即可。

The validation process is similar to that of Bitcoin, with a nonce value, which can only be verified once.

验证过程跟挖矿过程类似,对于全节点来说,在内存中保存了大的DAG,只需循环计算64次后得到最后的哈希值与目标值比较即可;对于轻节点来说,首先通过小的cache计算出大的DAG后再计算,后面过程跟全节点一样了。

The validation process is similar to the excavation process, where large DAGs are saved in the memory for the whole node, and the final Hashi values are compared to the target values only 64 times after recycling; for light nodes, large DAGs are calculated first through small cache, and the subsequent process is the same as the whole node.

以太坊共识机制共有四个阶段,即Frontier(前沿)、Homestead(家园)、Metropolis(大都会)、Serenity(宁静)。以太坊前三个阶段采用的是POW共识机。第四个阶段将采用自己创建的POS机制,名为Casper投注共识,这种机制增加了惩罚机制,并基于POS的思想在记账节点中选取验证人。

There are four phases of the ETA consensus mechanism, namely, Frontier, Homestead, Metropolis, and Serenity. The first three phases of ETA are the POW consensus mechanism. The fourth phase will use the self-created POS mechanism, called Casper's Consensus, which increases the punitive mechanism and selects the certifier in the account node based on the POS idea.

POW即工作量证明,是比特币系统中采用的共识机制。(本文主要讲解以太坊的共识机制)

The Pow, the workload, has proved to be the consensus mechanism used in the Bitcoin system. (This paper focuses on the consensus mechanism of the Etherms.)

谈起Casper投注共识,要先说POS。POS即权益证明,主要特点以权益证明代替工作量证明,由具有最高权益的节点实现新块加入和获得激励收益。POS共识是为解决POW共识机制的资源浪费和安全性缺陷而提出的替代方案。它的本质是采用权益证明来代替POW中的基于哈希算力的工作量证明,是由系统中具有最高权益而非最高算力的节点获得区块记账权。权益体现为节点对特定数量货币的所有权,称为币龄或币天数(Coindays)。

When it comes to Casper's consensus, let us start with POS. POS is proof of equity. The main feature is proof of entitlement in lieu of proof of workload, with the inclusion of a new block of interest and incentive gains. The POS consensus is an alternative to addressing the waste of resources and security deficiencies of the POW consensus mechanism. Its essence is to replace PAW with proof of Hashi-based workload, which is that the system has the highest interest rather than the highest value.

币龄是特定数量的币与其最后一次交易的时间长度的乘积,每次交易都将会消耗掉特定数量的币龄。例如某人在一笔交易中收到10个币后并持有10天,则获得100币龄;而后其花掉5个币后则消耗掉50币龄,显然采用POS共识机制的系统在特定时间点上的币龄总数是有限的,长期持币者更倾向于拥有更多币龄,因此币龄可视为其在POS系统中的权益。

For example, when a person receives 10 coins in a transaction and holds them for 10 days, he gets 100 coins; when a person spends 5 coins, he consumes 50 coins. It is clear that the system that uses the POS Consensus mechanism is limited in its total amount of money at a given point in time, and that long-term holders are more likely to have more currency years, so that the currency age can be regarded as their interest in the POS system.

投注共识是以太坊下一代的共识机制Casper(鬼马小精灵)引入的一个全新概念,属于POS。Casper的共识是按区块达成的,而不像POS那样按链达成。

The consensus is a completely new concept introduced by the next generation of Tai Ho's consensus mechanism, Casper, which belongs to POS. Casper's consensus is built by blocks, not by chain, as it is done by POS.

为了防止验证人在不同的世界中提供不同的投注,还有一个简单严格的条款:如果你两次的投注序号一样,或者说你提交了一个无法让Casper依照合约处理的投注,你将失去所有保证金。从这一点可以看出,Casper与传统的POS不同的是,Casper有惩罚机制,这样非法节点通过恶意攻击网络不仅得不到交易费,而且还面临着保证金被没收的风险。

In order to prevent the certifiers from offering different kinds of bets in different worlds, there is a simple and strict clause: if you two do the same numbering, or if you submit an indentation that Casper cannot handle under the contract, you will lose all the bonds. It is clear from this that Casper, unlike the traditional POS, has a punitive mechanism, so that illegal nodes not only do not receive transaction fees through malicious attacks on networks, but also face the risk that the bonds will be confiscated.

Casper协议下的验证人需要完成出块和投注两个活动。具体如下:

The certifier under the Casper agreement is required to complete two activities:

出块是一个独立于其他所有时间而发生的过程,验证人收集交易,当轮到他们的出块时间时,他们就制造一个区块,并签名,然后发送到网络上。投注的过程更为复杂一些,目前Casper默认的验证人策略被设计为模仿传统的拜占庭容错共识:观察其他的验证人如何投注,取33%处的值,向0或1进一步移动。

Blocks are a process that takes place independently of all other times, where the certifiers collect transactions and when their turn comes, they create a block and sign and send it to the network. The process of betting is more complex, and the current default certifier strategy of Casper is designed to imitate traditional Byzantine tolerance consensus: to observe how other certifiers invest, to take a value of 33 per cent and move further to 0 or 1.

而客户端确认当前状态的过程是这样的:一开始先下载所有的区块和投注,然后用上面的算法来形成自己的意见,但是不公布意见;它只是简单地按顺序在每个高度进行观察,如果一个区块的概率高于0.5就处理它,否则就跳过它。在处理所有的区块之后,所得到的状态就可以显示为区块链的当前状态”。

The process by which the current state is confirmed by the client is as follows: first download all blocks and bets, then use the algorithm above to form its opinion, but not publish it; it simply looks at each altitude in order, if the probability of a block is higher than 0.5, or skips it. After processing all blocks, the resulting state can be shown as the current state of the block chain & rdquao;

以上就是以太坊共识算法是什么的相关内容。总之,ethash基本思路和比特币的pow类似,都是不断随机nonce得到的值与难度进行比较,满足条件则挖矿成功,否则继续尝试。与比特币比拼cpu算力不同的是,ethash通过生成一个巨大的数据集,通过限制内存来防止具备强大算力的ASIC矿机垄断,增强了去中心化能力。

In short, the basic idea of ethash, similar to that of Bitcoin, is a constant random comparison of the values and difficulties received by nónce and the fulfilment of the conditions is a success in mining, otherwise the attempt continues. Unlike Bitcoin’s collage of cpu algorithms, ethash enhances the ability to decentralize by generating a huge data set that prevents a powerful arithmetic ASIC miner monopoly by limiting memory.

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=68701

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友