Skip to content

Commit

Permalink
Merge pull request #5897 from jmcook1186/pow-mining
Browse files Browse the repository at this point in the history
migrate info on pow-mining from ethdocs and eth.wiki
  • Loading branch information
minimalsm authored May 10, 2022
2 parents 0a1c019 + e8273ea commit 0d87e8f
Show file tree
Hide file tree
Showing 8 changed files with 1,412 additions and 1 deletion.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Mining algorithms
description: A detailed look at the algorithms used for Ethereum mining.
lang: en
sidebar: true
incomplete: false
---

Ethereum mining has used two mining algorithms, Dagger Hashimoto and Ethash. Dagger Hashimoto was never used to to mine Ethereum, being superseded by Ethash before mainet launched. It was a R&D minign algorithm that paved the way for Ethash. However, it has historical significance as an important innovation in Ethereum's development. Proof-of-work mining itself will be deprecated in favor of proof-of-stake during [The Merge](/merge/), which is forecast to happen in Q3-Q4 2022.

The fundamental idea of both mining algorithms is that a miner tries to find a nonce input using brute force computation so that the result is below a certain difficulty threshold. This difficulty threshold can be dynamically adjusted, allowing block production to happen at a regular interval.

## Prerequisites {#prerequisites}

To better understand this page, we recommend you first read up on [proof-of-work consensus](/pow) and [mining](/mining).

## Dagger Hashimoto {#dagger-hashimoto}

Dagger Hashimoto was a precursor research algorithm for Ethereum mining that Ethash superseded. It was an amalgamation of two different algorithms: Dagger and Hashimoto.

[Dagger](http://www.hashcash.org/papers/dagger.html) involves the generation of a [Directed Acyclic Graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph), random slices of which get hashed together. The core principle is that each nonce only requires a small portion of a large total data tree. Recomputing the subtree for each nonce is prohibitive for mining - hence the need to store the tree - but okay for a single nonce’s worth of verification. Dagger was designed to be an alternative to existing algorithms like Scrypt, which are memory-hard but difficult to verify when their memory-hardness increases to genuinely secure levels. However, Dagger was vulnerable to shared memory hardware acceleration and dropped in favor of other avenues of research.

[Hashimoto](http://diyhpl.us/%7Ebryan/papers2/bitcoin/meh/hashimoto.pdf) is an algorithm that adds ASIC-resistance by being I/O bound (i.e. memory reads are the limiting factor in the mining process). The theory is that RAM is more available than computation; billions of dollars worth of research have already investigated optimizing RAM for different use cases, which often involve near-random access patterns (hence “random access memory”). As a result, existing RAM is likely to be moderately close to optimal for evaluating the algorithm. Hashimoto uses the blockchain as a source of data, simultaneously satisfying (1) and (3) above.

Dagger-Hashimoto used amended versions of the Dagger and Hashimoto algorithms. The difference between Dagger Hashimoto and Hashimoto is that, instead of using the blockchain as a data source, Dagger Hashimoto uses a custom-generated data set, which updates based on block data every N blocks. The data set is generated using the Dagger algorithm, allowing for efficiently calculating a subset specific to every nonce for the light client verification algorithm. The difference between Dagger Hashimoto and Dagger is that, unlike in the original Dagger, the dataset used to query the block is semi-permanent, only being updated at occasional intervals (e.g. once per week). This means that the portion of the effort of generating the dataset is close to zero, so Sergio Lerner’s arguments regarding shared memory speedups become negligible.

More on [Dagger-Hashimoto](/developers/docs/consensus-mechanisms/pow/mining-algorithms/dagger-hashimoto).

## Ethash {#ethash}

Ethash is Ethereum's current mining algorithm. Ethash was effectively a new name given to a specific version of Dagger-Hashimoto after the algorithm got significantly updated, whilst still inheriting the fundamental principles of its predecessor. Ethereum mainnet has only ever used Ethash - Dagger Hashimoto was an R&D version of the mining algorithm that was superseded before mining started on Ethereum mainnet.

[More on Ethash](/developers/docs/consensus-mechanisms/pow/mining-algorithms/ethash).

## Further reading {#further-reading}

_Know of a community resource that helped you? Edit this page and add it!_

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Mining
description: An explanation of how mining works in Ethereum and how it helps keep Ethereum secure and decentralized.
lang: en
sidebar: true
incomplete: true
incomplete: false
---

## Prerequisites {#prerequisites}
Expand All @@ -14,6 +14,10 @@ To better understand this page, we recommend you first read up on [transactions]

Mining is the process of creating a block of transactions to be added to the Ethereum blockchain.

The word mining originates in the context of the gold analogy for crypto currencies. Gold or precious metals are scarce, so are digital tokens, and the only way to increase the total volume is through mining. This is appropriate to the extent that in Ethereum too, the only mode of issuance post launch is via mining. Unlike these examples however, mining is also the way to secure the network by creating, verifying, publishing and propagating blocks in the blockchain.

Mining ether = Securing the Network

Ethereum, like Bitcoin, currently uses a [proof-of-work (PoW)](/developers/docs/consensus-mechanisms/pow/) consensus mechanism. Mining is the lifeblood of proof-of-work. Ethereum miners - computers running software - using their time and computation power to process transactions and produce blocks.

<InfoBanner emoji=":wave:">
Expand Down Expand Up @@ -60,6 +64,12 @@ Watch Austin walk you through mining and the proof-of-work blockchain.

<YouTube id="zcX7OJ-L8XQ" />

## The mining algorithm {#mining-algorithm}

The Ethereum mining algorithm has undergone several upgrades since its inception. The original algorithm, "Dagger Hashimoto" was based around the provision of a large, transient, randomly generated dataset which forms a [Directed Acyclic Graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) (the Dagger-part), with miners attempting to solve a particular constraint on it, partly determined through a block’s header-hash. This algorithm was novel because it had high memory-access bandwidth requirements but could be run using a modest processor, making it GPU-friendly but resistant to the type of ASIC-driven hardware arms race that could pose a centralization risk (more on [problems with ASICS](https://www.investopedia.com/investing/why-centralized-crypto-mining-growing-problem/)). After substantial upgrades to the algorithm, it was renamed to "Ethash". This renaming happened before mining began on Ethereum mainnet. Dagger-Hashimoto was a precursor, research algorithm that was not used on Ethereum mainnet.

More information on these mining algorithms is available at our [mining algorithms page](/developers/docs/consensus-mechanisms/pow/mining-algorithms/).

## Further reading {#further-reading}

- [What does it mean to mine Ethereum?](https://docs.ethhub.io/using-ethereum/mining/) _EthHub_
Expand Down
8 changes: 8 additions & 0 deletions src/data/developer-docs-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
items:
- id: docs-nav-mining
to: /developers/docs/consensus-mechanisms/pow/mining/
items:
- id: docs-nav-mining-algorithms
to: /developers/docs/consensus-mechanisms/pow/mining-algorithms/
items:
- id: docs-nav-dagger-hashamoto
to: /developers/docs/consensus-mechanisms/pow/mining-algorithms/dagger-hashamoto
- id: docs-nav-ethash
to: /developers/docs/consensus-mechanisms/pow/mining-algorithms/ethash
- id: docs-nav-proof-of-stake
to: /developers/docs/consensus-mechanisms/pos/
- id: docs-nav-ethereum-stack
Expand Down
3 changes: 3 additions & 0 deletions src/intl/en/page-developers-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"docs-nav-mev": "Miner extractable value (MEV)",
"docs-nav-mev-description": "How value is extracted from the Ethereum blockchain beyond the block reward",
"docs-nav-mining": "Mining",
"docs-nav-mining-algorithms": "Mining algorithms",
"docs-nav-dagger-hashamoto": "Dagger-Hashamoto",
"docs-nav-ethash": "Ethash",
"docs-nav-networks": "Networks",
"docs-nav-networks-description": "Implementations of Ethereum including test networks",
"docs-nav-nodes-and-clients": "Nodes and clients",
Expand Down
2 changes: 2 additions & 0 deletions src/intl/en/page-developers-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"page-developers-mev-link": "Miner extractable value (MEV)",
"page-developers-mining-desc": "How new blocks are created and consensus is reached",
"page-developers-mining-link": "Mining",
"page-developers-mining-algorithms-desc": "Information on Ethereum's mining algorithms",
"page-developers-mining-algorithms-link": "Mining algorithms",
"page-developers-networks-desc": "An overview of Mainnet and the test networks",
"page-developers-networks-link": "Networks",
"page-developers-node-clients-desc": "How blocks and transactions are verified in the network",
Expand Down
7 changes: 7 additions & 0 deletions src/pages/developers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ const DevelopersPage = ({ data }) => {
<p>
<Translation id="page-developers-mining-desc" />
</p>

<Link to="/developers/docs/consensus-mechanisms/pow/mining-algorithms/">
<Translation id="page-developers-mining-algorithms-link" />
</Link>
<p>
<Translation id="page-developers-mining-algorithms-desc" />
</p>
</Column>
<RightColumn>
<h3>
Expand Down

0 comments on commit 0d87e8f

Please sign in to comment.