What is merged mining?
Merged mining is a process of mining two cryptocurrencies with a same algorithm simultaneously. This allows the miner to direct his hashing power into mining two cryptocurrencies at once, resulting in higher hash rates for both of them. As the miner contributes to the total hash rate of both blockchains, he contributes to making both networks more secure.
How Does Merged Mining Increase Security
In short, a cryptocurrency can suffer from a 51% attack. A 51% attack is an event where outside malicious players find an exploit or collect enough hashing power to take over a blockchain. Such attacks aren’t a problem with big cryptocurrencies like Bitcoin. The hash rate these major coins clock is so high that it’s impossible for one single entity (or even a group of them) to band together and perform a 51% attack against their network.
With a smaller currency, these attacks become a real issue. A coin that has low hash rate can be taken over with not that much hash power. If the malicious player manages to take over such a network, he can exploit it and make it “dance to his tune”. With such a takeover, the attacker can censor certain transactions, exclude other miners from reaping mining rewards or perform double spending (a digital equivalent of counterfeit).
Merged mining allows miners to borrow their hash power to these weaker cryptocurrencies. With this process, also known as Auxiliary Proof-of-Work, both cryptocurrencies can at the same time enjoy the benefits of having their hash rate increased, benefits which include the increased security. This method was first used by Namecoin in 2011, with Bitcoin as the parent cryptocurrency.
How Does Merged Mining Work
The process of setting up and performing merged mining is somewhat complicated. To start with merged mining, you will need to find two cryptocurrencies that have the same hashing algorithms. SHA-256, Scrypt, Equihash are just some of the most popular PoW algorithms out there currently used by major cryptocurrencies like Bitcoin, Litecoin, Zcash, etc. Popular merged mining pairings include:
More technically speaking, Auxiliary Proof-of-Work (POW) is the relationship between two blockchains where one trusts the other’s work and accepts AuxPOW blocks. The process itself has two blockchains and each of them has its own name:
The Auxiliary blockchain is the one that will be accepting the work of the other blockchain. Therefore, the auxiliary chain will need to go through additional development and adjustments before it becomes ready to take part in merged mining.
The Parent blockchain will be the one where actual mining will be performed. In this relationship, only the auxiliary blockchain needs to be aware of the “auxiliary PoW logic”; the parent blockchain has valid blocks so it doesn’t need to be aware of said logic.
First step of the process of merged mining requires assembling a transaction set (a block) for both blockchains. Both chains have different difficulty levels, where the parent chain levels are usually much higher than the auxiliary chain. For the parent chain, there is almost no difference between a block mined the regular way and a block mined as part of a merged coin mining process. That’s why there is no need to modify the code of the daemon (also called full-node, or client) of the parent blockchain. For the auxiliary chain, a block mined the normal way (i.e a regular block) will be accepted with the original code. However, a block mined as a part of a merged coin mining process (i.e a modified block) will require a modification of the code of the AUX daemon.
The key to understand merged mining is that a modified block in the AUX chain will not look valid to an AUX daemon that only knows how to process regular blocks. To accept a modified block, the AUX daemon must rely on some API calls to the PRT chain. The AUX daemon needs to make sure that:
- the modified block contains a hash of a valid block on the PRT chain
- this PRT valid block itself contains a hash to the current AUX block header
The auxiliary blockchains Merkle root is inserted into the extra nonce section of the parent blockchain – i.e. Bitcoin or Litecoin with Dogecoin and Namecoin as the auxiliary chain. In simpler terms, the parent chain contains the standard transactions plus a transaction with the hash that connects to the auxiliary chain block. Since the information of one chain’s set of hashes has been incorporated into a part of the other blockchain then the proof of work can be achieved if a solution with a specific difficulty has been performed.
From here, the mining can begin. Two scenarios can unfold:
- The parent chain can find the solution and add the block
If a miner solves the hash at the parent difficulty level, a parent block is assembled and sent to the parent network. The auxiliary hash does nothing and the parent network ignores it. The parent hash that was solved has a higher difficulty; as you also mine on the auxiliary chain, you will assemble an auxiliary block and receive mining rewards in auxiliary blockchain coins as well.
- The auxiliary chain can find the solution and add the block
If a miner solves the hash at the auxiliary difficulty level, a auxiliary block is assembled. It includes the auxiliary transaction set, the auxiliary block header, the parent block header and the hash of the rest of the transactions in the parent block. This entire “mess” is then submitted to the auxiliary system. The auxiliary system, supporting merged mining, accepts this as proof of work because it contains work that must have been done after the block header and auxiliary transaction set was built. As a reward for his work, the miner receives auxiliary chain coins.
In short, blocks will be produced on both chains if the parent chain hash is solved; on the other hand, single block will be produced on the auxiliary chain if the auxiliary chain hash is solved. The two hash chains remain fully independent. The parent chain elements that go in the auxiliary chain block are basically ignored and only used to validate the proof of work. The bloat of the auxiliary chain network is minimal and is represented in some blocks on it having an extra block header and an extra hash added to them.
There are many positive things that come with merge mining:
Increased auxiliary blockchain security attracts additional investors
Tying themselves to a parent chain gives auxiliary chains access to extra hash power that keeps them safe from 51% attacks. A safer coin is immediately more attractive to potential investors. Perhaps the best example of this was seen with Dogecoin, whose market capitalization almost doubled after the coin announced a switch to merge mining with Litecoin.
Computing power and electricity is saved, profitability is increased
Merge mining is a process where a miner solves two hash functions simultaneously. A miner is motivated to use his resources to mine as much coin as possible. Having two coins mined for the price of one power/electricity expenditure helps miners save up resources while providing the same amounts of hash power to both networks. It also gives them an ability to earn more for doing the same work, which is always a bonus and a good motivator to get into merge mining.
The parent chain doesn’t suffer
No additional work is added to the parent chain. It only needs to deal with the auxiliary chain hashes that are added through the connecting transaction, which requires a miniscule amount of resources.
Coins have to compete for miners. When a miner decides he wants to mine one cryptocurrency, other currencies lose out. Even when you have a dominant/lesser cryptocurrency in terms of hashrate, there is still a small chance that one will lose out to the other. Merged mining eliminates this possibility by making it so that each coin can thrive on its own merits and not have to compete for miners to survive.
Some people don’t agree with merge mining though as it isn’t completely free of costs. To start performing merge mining the miner will need to purchase and manage extra bandwidth and storage. This isn’t a problem for major mining pools that have the resources to expand their networks; however smaller operators might struggle to manage more chains at once. There is also the problem of the auxiliary chain having to perform a hard fork to become merge mining capable.
Merge mining increases the already large risk of mining centralization, as large mining pools group together to share profits from it while running high-end supercomputers against which regular individuals cannot compete with their commercial-grade hardware.
Merge mining exacerbates this issue, as the additional investment required to set it up means that fewer and fewer independent nodes are capable of adjusting to it. Additionally, with the increase of external hash power that comes with merged mining, mining difficulty increases and mining payouts become smaller for the auxiliary chain-focused individual nodes. In the long run, these nodes will drop out, leaving the mining centralized among the few powerful mining pools.
There are many projects out there that have embarked on the merge mining adventure, looking to secure their chains and potentially attract additional interest for their coins that way. Namecoin was one of the first ones to do so. This Bitcoin fork decided to stay on the SHA 256 algorithm which enabled the mining connection in the first place. Dogecoin was the next major cryptocurrency to take this route.
The decision to enable merge mining with Litecoin was quite controversial, as some parts of the community were against it. You can find the original Reddit discussion thread here. Lesser known projects like FantomCoin and Elastos have also embarked on merge mining routes, looking to benefit from being mined alongside Monero and Bitcoin respectively. Ultimately, merge mining has its positives and negatives and it remains a popular method of protecting a young vulnerable currency from early pains like 51% attacks.
We should expect to see more projects embrace it in the near future.