After reading the Ethash wiki, I kind of get DAG is something that every node can identically generate to verify the work. However I don't get how the DAG is related to Merkle Tree. Can anyone explain in detail?
-
1What is a DAG: ethereum.stackexchange.com/questions/1993/…– Herman JungeJan 24, 2017 at 7:45
-
1How does a merkle patricia trie works: ethereum.stackexchange.com/questions/6415/…– Herman JungeJan 24, 2017 at 7:46
-
Merkling in Ethereum: blog.ethereum.org/2015/11/15/merkling-in-ethereum– Herman JungeJan 24, 2017 at 7:46
-
I think I get what a DAG is. However since I'm new to cryptocurrency, specially Ethereum, i couldn't connect things together to see how DAG and merkle tree related.– vutranJan 24, 2017 at 7:46
-
1DAG is used for mining, Merkle tree is a structure used to store the state of the blockchain. Read the links given.– Herman JungeJan 24, 2017 at 7:47
1 Answer
The Ethash DAG is not related to merkle trees (the word "merkle" does not appear on either wiki page). The Ethash DAG only serves as a big dataset (i.e. too big to fit in memory) for making Ethash mining be "memory-hard".
Ethereum's merkle tree is what keeps track of the state of all accounts and contracts. The state of all accounts is not directly related to the Ethash mining algorithm. When the Ethereum protocol switches from Ethash PoW to Casper PoS, the Ethash DAG will be completely dropped. But the merkle tree of all account states is essential and will remain.
You might be confusing the Ethash DAG with the phrase "Merkle DAG" used to describe the IPLD data structure of IPFS. IPFS uses the phrase "Merkle DAG" (Merkle Directed Acyclic Graph) because each IPFS address is a merkle hash, and links from address to address form something like a "merkle graph". Since IPFS is natural fit for merkle trees, some Ethereum and IPFS developers are working on hosting the Ethereum state on IPFS.