What is DAG in mining?
You have probably heard of DAG in mining.
DAG (Directed Acyclic Graphs) is a mathematical and computational construct that allows the creation of distributed systems and networks with many functional similarities to those proposed by blockchains.
The DAG is a directed acyclic graph. It is notably used by the Ethereum Classic cryptocurrency and other coins operating in a Proof of Work system.
Similar to blockchains, DAG is slowly becoming established as an interesting technology in the context of mining, especially when miners use GPUs in their activity.
In this article, we will find out what DAG is and how it works, as well as the DAG size and DAG file in mining.
Mining DAG meaning
The creation of blockchain technology by Satoshi Nakamoto was a technological revolution. Since then, many developments have tried to position themselves as the next big thing. Hence the creation of the DAG in mining.
The DAG is a known construction in the mathematical and computer world for many years. The study of this type of structure began in 1878, when James Joseph Sylvester, an English mathematician, began his studies of graphs. This is when we realize that DAG is an older technology than blockchain!
With the mining of cryptocurrencies, the DAG has attracted attention because of its technical possibility to build distributed systems identical to those created with the blockchain. This technology is considered to be a tool capable of offering the functionality of the blockchain, also promising significant improvements.
DAG has been known since the development of graph theories in mathematics, which were then used in computer science. When we talk about DAG, we are talking about a graph with two properties. On the one hand, the DAG is directed, on the other hand, the DAG is acyclic.
A graph is directed when all the vertices (we talk about blocks in a blokchain that are part of the graph are connected by edges (like the hash) that point in a well-defined direction.
A graph is acyclic when a graph has no cycles of movement. In other words, it is impossible to go from one vertex of the graph, through the rest of its vertices, and end at the vertex where the graph began.
Definition : A DAG is therefore a finite directed graph, without directed cycles. This means that its vertices are connected by edges with a specific direction and the whole graph takes us from point A to point B, without the possibility of returning to point A.
But what does graphs have to do with cryptocurrency mining (by the way, feel free to start mining on Cruxpool)?
A blockchain is based on information grouped into sets. This information is linked in an orderly and cryptographic way to a previous set. This relationship cannot be broken at any time in the blockchain without immediately replacing the following blocks.
The block join structure associated with a blockchain creates strong immutability. If the blockchain is modified, a fork is generated.
We can do the same thing with a DAG in mining!
Through this diagram (inspirated by the one of Bit2Me), we can see that there is a relationship between the vertices (the blocks) and that this relationship is given by the edges (the hash). If an edge is modified in the DAG, its relation is rewritten, generating a new DAG, and thus a different history (like a fork in the blockchain).
Note that it is also possible to recreate the same relationship given in the blockchain using this type of graph.
Properties of DAG in mining
DAGs have certain properties that are vital to their functioning.
First, they have a starting point and an ending point. By being directed, this ensures that our route always goes from an origin point to an end point, and we cannot go back on that route. If the construction of this structure is applied consecutively, we will create an incremental history within the DAG. Just like in a blockchain.
Then, changing a relationship between vertices rewrites the entire DAG, because its structure and weight have changed. This is equivalent to a modification of a block in the blockchain.
DAGs are also parallelizable. Indeed, a DAG can have a parallel generation and different value paths between different vertices. This optimizes its generation and the ability to verify the relationship between vertices and the information they contain.
Furthermore, a unique property of DAGs is that their structure can be reduced to an optimal point where their path meets all the relations specified in them without any loss. This essentially means that it is possible to reduce the relations of vertices to a minimum point where such a reduction does not affect the ability to verify the information of a vertex at any time.
DAG VS blockchain: What are the differences?
So what is the best choice between a DAG and a blockchain?
The answer to this question is complex and answering it depends on putting several things into perspective.
Compared to blockchain, DAGs are a technology that is still experimental in the context of cryptocurrency mining.
The creation of a mining system and consensus is much more complex in a DAG. The way in which blocks can be generated, create relationships between them, reduce said relationships without losses, among other functions, adds a higher level of algorithmic complexity.
There are no miners per se in a DAG as there are in a blockchain, so there are no high-value fees or commissions paid. Because of the ease of cryptographic validation, the nodes’ earnings for confirmed transactions are recouped by the total volume of transactions tracked, among other services the node can provide.
It is also interesting to know that transactions in a DAG create a pattern called “double-committed transactions”. This means that a transaction with only two confirmations can be considered irreversible, which can take a few seconds due to the parallel work of the network.
DAG size and DAG file in mining
It is crucial to know the current and future size of a DAG file. This is because a DAG file has a major impact on the speed of cryptocurrency mining.
The DAG file is located directly in the VRAM of a GPU. But, if the DAG file is larger than the memory of the GPU, then the GPU will become useless.
Learn more about how to optimize your mining with GPUs hashrate.
To find out what the future size of the DAG file will be, you can use a calculator or consult the table on specialized sites to find out the end of operation with a certain GPU.
The DAG file changes size at each new level. A new level is created after a total of 30,000 mined blocks (equivalent to 1 epoch for Ethash). The increasing speed of the DAG file size evolution depends directly on the time it takes to find a block.
However, the time it takes to mine a block is not stable, it can vary between 10 and 60 seconds depending on the cryptocurrency mined. Thus, the time it takes each tier is not defined in terms of duration, but in terms of blocks.
On average, the DAG file grew by a factor of 0.72 per year for Ethereum. For other cryptocurrencies whose blocks take longer to generate, this DAG file search time increases more slowly and the GPUs can therefore run longer.
DAG is a powerful technology, just like blockchain. In fact, it is a key element if you want to dual mine. Anyway, we hope this article will help you to see more clearly about DAG in mining.
Do not hesitate to join us on the Cruxpool Discord if you have any questions or simply want to join our mining community!