以太坊连载:什么是挖矿和Ethash算法?

资讯 2024-07-11 阅读:52 评论:0
FinTech前哨FinTech outpost.区块链 大数据Block Chain Big Data人工智能 VR/ARArtificial intelligence VR/AR挖矿简介Overview of mining挖矿这个词源于...
美化布局示例

欧易(OKX)最新版本

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

APP下载   全球官网 大陆官网

币安(Binance)最新版本

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

APP下载   官网地址

火币HTX最新版本

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

APP下载   官网地址

FinTech前哨

FinTech outpost.

区块链 大数据

Block Chain Big Data

人工智能 VR/AR

Artificial intelligence VR/AR

挖矿简介

Overview of mining

挖矿这个词源于对加密货币与黄金的类比。黄金或贵金属很稀有,电子代币也是,增加总量的唯一方法就是挖矿。以太坊也是这样,发行的唯一办法就是挖矿。但是不像其他例子,挖矿也是通过在区块链中创建、验证、发行和传播区块来保护网络的方法。

The term mining is derived from the analogy between encoded money and gold. Gold or precious metals are rare, and electronic tokens are the only way to increase the volume. The same is true of Ether, where mining is the only method of distribution.

挖以太币=保护网络=验证计算

Digging in taser = Protected Network = Authentication

什么是挖矿?

What's mining?

以太坊,和所有区块链技术一样,使用激励驱动的安全模式。共识基于选择具有最高总难度的区块。矿工创造区块,其他人检测有效性。区块只有在包含特定难度的工作量时才有效,还有其他合格性条件。请注意到以太坊Serenity里程碑,可能就会被取代(参考权益证明模型)。

In Taipan, as in all block chain technologies, use an incentive-driven security model. Consensus is based on the selection of blocks that have the highest overall difficulty. Miners create blocks, and others test their effectiveness. Blocks are only effective if they contain a particular difficulty of workload, and there are other eligibility conditions.

以太坊区块链在很多方面与比特币区块链类似,但也有些不同。在区块链架构方面,以太坊和比特币之间最主要的的区别是,不像比特币,以太坊区块不仅包含交易列表也包含最近状态(merkle patricia特里结构的根散表编码在状态中更精确)除此之外,另外两个值,区块数和难度,也储存在区块中。

In many ways, the ETA block chain is similar to that of the Bitcoin block, but it is also somewhat different. The most important difference in the structure of the ETA block is that, unlike Bitcoin, it contains not only the list of transactions but also the most recent state (the root table code of the Merkle PatriciaTrie structure is more accurate in its state), the other two values, the number of blocks and the difficulty are stored in the blocks.

使用的工作量证明算法叫Ethash(Dagger-Hashimoto算法的改良版本),包括找到算法的随机数输入以使结果低于特定的难度阈值。工作量证明算法的意义在于,要找到这样一个随机数,没有比列举可能性更好的策略,而解决方法的验证琐碎又廉价。由于输出有均匀分布(是散表功能应用的结果),我们可以保证,平均而言,需要找到这样一个随机数的时间取决于难度阈值。这使得只通过操纵难度来控制找到新区块的时间成为可能。

The workload proof algorithm used is called Ethash (an improved version of the Dagger-Hashimoto algorithm), which includes finding random number input to the algorithm so that the result is lower than a given difficulty threshold. The significance of the workload proof algorithm is that there is no better strategy to find such a random number than listing possibilities, and the solution can be verified cheaply. Given that the output is evenly distributed (as a result of the scattered table function), we can ensure that, on average, the time required to find such a random number depends on the difficulty threshold.

正如协议中所描述的,难度动态调整的方式是每15秒整个网络会产生一个区块。我们说网络用15秒区块时间生产一个区块链。这个“心跳”基本上主要强调系统状态同步,保证不可能维持一个分叉(允许double spend)或被恶意分子重写历史,除非攻击者有半数以上的网络挖矿能力(即所谓的51%攻击)。

As described in the protocol, the difficulty dynamic adjustment is that the entire network produces a block every 15 seconds. We say that the network uses 15 seconds to produce a block chain. This “heart beat” essentially emphasizes system synchronization and guarantees that it will not be possible to maintain a fork (to allow a double spend) or to be rewritten by malicious elements unless the attacker has more than half of the network's mining capacity (so-called 51 per cent attack).

任何参与到网络的节点都可能是矿工,预期的挖矿收益和他们的(相对)挖矿能力或者说成正比,比如被网络总散表率标准化的,每秒尝试的随机数数量。

Any node involved in the network may be a miner, with expected mining proceeds versus their (relative) mining capacity or a positive ratio, such as the random number of attempts per second, standardized by the total spread scale of the network.

Ethash工作量证明是内存难解的,这使它能抵抗ASIC。内存难解性由工作量证明算法实现,需要选择依靠随机数和区块标题的固定资源的子集合。这个资源(几十亿字节大小的数据)叫做DAG。每3000个区块的DAG完全不同,125小时的窗口叫做epoch(大约5.2天),需要一点时间来生成。由于DAG只由区块高度决定,它可以被事先生成,如果没有被事先生成,客户端需要等到进程最后来生产区块。如果客户端没有预生成并提前缓存DAG,网络可能会在每个epoch过渡经历大规模区块延迟。注意不必要生成DAG以验证工作量证明,它可以在低CPU和小内存的状态下被验证。

The Ethash workload has proved to be ingrained, enabling it to resist ASIC. The internal solvency is achieved by workload proof algorithms, which require the selection of a subset of fixed resources based on random numbers and block captions. This resource (numbers of billions of bytes of data) is called DAG. The 125-hour window is completely different for every 3,000 blocks. The 125-hour window is called epoch (approximately 5.2 days). Since DAG is only determined by block height, it can be generated in advance, and if it is not generated in advance, the client needs to wait until the final stage of the process.

在特殊情况下,从零开始创建节点的时候,只有在为现存epoch创建DAG的时候才会开始挖矿。

In exceptional cases, when nodes are created from scratch, mining starts only when the DAG is created for the existing epoch.

挖矿奖励

Incentives for mining

获奖区块的成功工作量证明矿工会获得:

The successful workload of the winning blocks attests to the fact that the mining unions received:

“获胜”区块的静态区块奖,包含5.0(5个)以太币

The "winner" block's static block prize, including 5.0 (5) in talisman

区块内支出的gas成本 — 一定数量的以太币,取决于当前gas价格

The cost of gas spent in the block – a certain amount in TT depending on current gas prices

叔伯块的额外奖励,形式是每个叔伯块包含额外的1/32

An extra reward for an uncle's piece, in the form of an extra one-and-a-half per uncle's block.

在区块中执行所有交易所消费的、由获胜矿工提交的gas都由每个交易的发送者支付。已发生的gas成本归到矿工账户作为共识协议的一部分。随着时间变化,这会使数据区块奖变得矮小。

The cost incurred is attributed to the miners’ account as part of the consensus agreement. This will make the data block prize short over time.

叔伯块是稳定的区块,比如说,和包含先前区块(最多回6个区块)的父区块。有效的叔伯块会受到奖励以中和网络滞后给挖矿奖励带来的影响,因而提升安全性(这叫做GHOST协议)。叔伯块由成功工作量证明矿工形成的区块中所包含的叔伯块接收7/8的数据区块奖励(=4.375以太币)。每个区块最多允许2个叔伯块。

An uncle's block is a stable block, for example, and a parent block containing a previous block (up to six blocks). Effective an uncle's block may be affected by incentives for mining by medium- and network lags (known as the GHOST agreement).

reddit上的叔伯块ELI5

Uncle ELI5 on Reddit

解释叔伯块的分论坛

Explaining uncle's sub-forum.

挖矿的成功取决于设定的区块难度。区块难度动态调整每个区块,以规定网络散列能力来创造12秒区块时间。找到区块的机会因此由与难度相关的散列率产生。

The success of mining depends on the difficulty of the blocks. Blocks are dynamically adjusted for each block to specify network hash capacity to create 12 seconds of block time. The chances of finding blocks are therefore derived from the hash ratio associated with the difficulty.

Ethash DAG

Ethash将DAG(有向非循环图)用于工作量证明算法,这是为每个epoch生成,例如,每3000个区块(125个小时,大约5.2天)。DAG要花很长时间生成。如果客户端只是按需要生成它,那么在找到新epoch第一个区块之前,每个epoch过渡都要等待很长时间。然而,DAG只取决于区块数量,所以可以预先计算来避免在每个epoch过渡过长的等待时间。Geth和ethminer执行自动的DAG生成,每次维持2个DAG以便epoch过渡流畅。挖矿从控制台操控的时候,自动DAG生成会被打开和关闭。如果geth用—mine选项启动的时候,也会默认打开。注意客户端分享DAG资源,如果你运行任何客户端的多个实例,确保自动的DAG生成只在一个实例中打开。

Ethash uses DAG (with non-circle maps) for workload proof algorithms, generated for each epoch, for example, every 3,000 blocks (125 hours, approximately 5.2 days). DAG takes a long time to generate. If the client simply generates it as needed, each epoch transition will take a long time to find the first block in the new epoch. However, DAG depends only on the number of blocks, so it can be calculated in advance to avoid excessive waiting times for each epoch. Geth and Ethminer perform the automatic DAG generation, maintaining two DAGs at each time to allow the epoch transition. The automatic DAG generation will be opened and shut when the mine is operated from the control table. If the geth-mine option starts, it will be opened by default.

为任意epoch生成DAG:

Generate DAG for any epoch:

实例geth makedag 360000 ~/.ethash.。请注意ethash为DAG使用~/.ethash (Mac/Linux) 或~/AppData/Ethash (Windows),这样它可以在不同的客户端实现以及多个运行实例中分享。

Example: eth makedag 360,000 ~/.ethash. Please note that ethash is used for DAG ~/.ethash (Mac/Linux) or ~/AppData/Ethash (Windows) so that it can be shared among different clients and in multiple examples of operations.

算法

Algorithms

我们的算法,Ethash(之前被称为Dagger-Hashimoto),是基于一个大的、瞬时的、任意生成的、形成DAG(Dagger-part)的资料组规定,尝试解决它一个特定的约束,部分通过区块标题散列来决定。

Our algorithm, Ethash (formerly known as Dagger-Hashimoto), is based on a large, instantaneous, randomly generated information group that forms the DAG (Dagger-part) and attempts to resolve a particular constraint, partly by hash of block headings.

它被设计用于在一个只有慢CPU的环境中来散列快速验证时间,但在被提供大量高带宽内存时,为挖矿提供大量的加速。大量内存需求意味着大规模矿工获得相对少的超线性利益。高带宽需求意味着从堆在很多超速处理单元、分享同样内存的加速在每个单独的单元给出很少的利益(译者注:通过阻止专用芯片共享内存的方式,降低矿机的作用)。

It is designed to be used for rapid validation in a slow CPU environment, but provides a significant acceleration in mining when large amounts of high bandwidth are provided. A large amount of storage needs means that large-scale miners receive relatively few ultralineal benefits. A high bandwidth demand means that little benefit is given in each individual unit from stacking many excess processing units, sharing equally stored accelerations (translation: reducing the role of a miner by preventing a dedicated chip from sharing memory).

没有节点验证的利益因而阻碍中心化,这在挖矿中很重要。

The benefits of not having nodes to validate thus hinder centralization is important in mining.

外部挖矿应用和以太坊工作规定和报送的后台程序之间的交流通过JSON-RPC API发生。提供两个RPC功能;eth_getWork和eth_submitWork。

Two RPC functions are provided; eth_getWork and eth_submitWork.

这些被正式记录在JSON-RPC API维基百科文章的矿工条目下。

These are officially recorded under the entry for miners in the JSON-RPC API Wikipedia article.

为了挖矿你需要一个完全同步的、能够挖矿的以太坊客户端和至少一个以太坊账户。这个账户用于发送挖矿奖励,通常被称为货币基或以太基。查看这个说明的“创建帐户”章节,学习如何创建帐户。

In order to dig, you need a fully synchronized Ether client capable of mining and at least one Ether account. This account is used to send mining incentives, often referred to as the monetary base or the Ether base. Look at the "Creating Account" chapter of this description and learn how to create an account.

警告:开始挖矿前,确保区块链和主链完全同步,否则就不能在主链上挖矿。

warns that will not be able to dig on the main chain without ensuring that the block chain and the main chain are fully synchronized before mining begins.

FinTech热搜榜

FinTech Hotlist

动画连载

Animated Serial

最新活动

Update

一个彩蛋

an egg

美化布局示例

欧易(OKX)最新版本

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

APP下载   全球官网 大陆官网

币安(Binance)最新版本

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

APP下载   官网地址

火币HTX最新版本

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

APP下载   官网地址
文字格式和图片示例

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

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

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

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!

    支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!
    2020年,新冠肺炎(COVID-19)疫情加速數位貨幣進展。例如:2019年4月,國際清算銀行(BIS)的調查顯示,在全球66家中央銀行中,沒有一家計畫發行跨境支付的數位貨幣。惟到了2020年10月,BIS支付委員會主席康利夫(Jon Cunliffe)指出,肺炎疫情拉高民眾對無現金支付的需求,迫使各國加快數位貨幣的研發進程日本與韓國於2021年進入數位貨幣試驗階段。直到2019年12月,美國聯邦準備理事會(Fed)都尚無數位貨幣規劃,惟到了2020年2月,Fed已開始研擬...
  • 区块链:交易系统开发指南

    区块链:交易系统开发指南
    播报编辑《区块链:交易系统开发指南》使用通俗易懂的语言,从技术的角度详细介绍了区块链交易系统应有的功能架构及工作原理,让人们能够张开双臂轻松地拥抱区块链技术,享受区块链交易系统带来的惊喜与成就感。《区块链:交易系统开发指南》共分 7 章,第 1~2 章主要介绍区块链及数字货币的基本概念,以及各种公有链的 API 接口;第3~5 章主要介绍区块链交易系统的分类架构及功能; 6 章主要介绍区块链交易系统面临的问题及演进方向;第 7 章对全书做了总结。《区块链:交易系统开发指南》是...
  • 5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪

    5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪
    今天,随着比特币(BTC)的价格突破62 000美元的门槛,顶级加密货币的价格反弹了。 此外,以铁大幅上涨,维持在2 900美元的水平。 此外,其他顶尖山硬币,如索拉纳(SOL )、XRP、卡达诺(ADA )也大幅上涨。    今天密钥加密货币价格 1. 比特币价格    在5月14日星期二撰写本文时,比特币价格上升了2.57%,达到62 487.50美元。 另一方面,在过去24小时内,交易量从65.26 % 急剧上升至277亿美元。 与此同时,加密货币的市场价值为...
  • OKEx回应用户质疑:合约交易非期货 平台无机器人

    OKEx回应用户质疑:合约交易非期货 平台无机器人
       热点点 自选股份 数据中心 数据中心 研究和资料中心 资金流动 模拟交易 客户客户 具体来说,OKEx回答用户的问题:合同交易不是期货,平台不是机器人。 金融同步化,3月22日。    昨天下午,OKEx公司就维护先前用户线下的权利问题对同步财务公司作出了回应,指出OKEx公司提供的合同交易不是期货交易,在旗下的业务中没有正式的机器人。 同时,OKEX称,它不会以非法为由对任何投资损失索赔作出答复。 答复全文如下: 同步你的财务! 近日来,...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
标签列表