Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: giszmo on October 12, 2011, 12:11:17 PM



Title: merged mining implications ... based on misconceptions ...
Post by: giszmo on October 12, 2011, 12:11:17 PM
Deleting a post/thread doesn't work and I don't intend to censor myself but the following is based on misconceptions about merged mining.
Maybe it would have been a nice idea to have merge mining the way I understood it but it isn't, so ... you can just close this tab :)

I have read into merged mining a bit today and might not have understood all aspects of it, but as far as I understood, it goes as follows:
The miner has to present the hash of predefined parameters (transactions, timestamp, etc) and some additional data that together results in something that hashes to "a nice number".
Merged mining now does exactly that but for the second block chain it swaps "predefined parameters" and "some additional data" for the second (and third, ...) block chain.
This way, n block chains can be secured at the hashing costs of one block chain.

Positive implications:
* Cool new block chains will get secured much faster than before
* Miners might even secure block chains that don't have a reward for mining just for the good of it. (Namecoin without coin generation would serve a good purpose, so people could support it without taking the generated coins.)
* Once all the major pools do merged mining for 20+ block chains, soon the last noob will understand that the hashing power behind any such block chain does not imply a USD/coin-rate lik many do here all the time. cosbycoin and poocoin will have 15TH.

Doubtful implications:
* "Zero fee" Acoin pools can merge mine B-Zcoin and make a profit from B-Z rewards

Negative implications:
* countless block chains might get support and confuse those who might want to use such digital currencies. Trust in each single such currency falls.

One very special implication:
* What if I receive a fork at my miner now? Until now I decide which one I mine for. It might turn out I mined for the wrong one when a follow up block gets found for the other one first. With merged mining I can just mine for both and if I find a block, announce it for both chains, just in case. This can go on for 20 forks and so on. Prepare to see very long living forks! If I'm right with my conclusions, we will need some mechanism to counter this chain pollution.


Title: Re: merged mining implications
Post by: DeathAndTaxes on October 12, 2011, 01:19:32 PM
Your understanding is flawed.

When you hash a block header that hash is ONLY useful for that exact block header.  Period.
Merge mining doesn't swap data.  If you swap data (and bit of data in BTC header) then it needs to be hashed again as the hash of the block header w/ different data has a different hash.

So how can one hash be potentially useful for both BTC and NMC?

The NMC protocol has been modified so that NMC data is ADDED (not swapped) into the BTC block header (in the coinbase transaction to be specific).  Since BTC network doesn't use coinbase transaction for any purpose other than extra-nonce (adding entropy) there is no conflict.


Every "merged" block going forward has additional NMC data inside the header.   Thus the hash of that header is potentially useful for securing the NMC block chain.  You can look it up in the block explorer right now. 

So the process is:
1) miner/pool adds NMC data into coinbase transaction
2) BTC merkle-tree root is computed as normal
3) miners hash trillions of hashes to find one with difficulty below target
4a) if hash is below BTC target it is valid for BTC network
4b) if hash is below NMC target it is valid for NMC network.

The NMC network can verify the hash is valid for BTC header which contains BTC merkle-tree.
The NMC network can then verify the BTC merkle-tree is valid for the coinbase transaction containing required NMC data.
Thus security for NMC network can be indirectly confirmed via BTC hash.


You can't accidentally hash multiple block chains.  You or your pool must explicitly include EXTRA alt-coin specific data in the BTC block before hashing it.

Quote
Once all the major pools do merged mining for 20+ block chains, soon the last noob will understand that the hashing power behind any such block chain does not imply a USD/coin-rate lik many do here all the time. cosbycoin and poocoin will have 15TH.

It is highly unlikely 15TH+ worth of pool operators are going to add 20+ different block chain specific data into every BTC header.  Those coins have little or no value.  Namecoin is somewhat unique because it is established, has some value, provides a useful non-competing function, and has decent liquidity.  Attribues all "scamcoins" lack.    This isn't to say BTC block chain won't be used to secure other assets in the future but your scenario is based on assumptions that don't exist. 

Lastly merged mining only works if the hashing algorithms are the same.  Many alt coins intentionally use completely incompatible hashing algorithms.  There is no method to merge mine those chains.


Quote
Dealing with a fork: With merged mining I can just mine for both and if I find a block, announce it for both chains, just in case.
I think you can see this is impossible now.  If BTC chain gets forked to mine both forks requires hashing both independent headers thus requires 2x the hashing power (just like it did prior to merged mining).


Title: Re: merged mining implications
Post by: BitterTea on October 12, 2011, 01:27:18 PM
One very special implication:
* What if I receive a fork at my miner now? Until now I decide which one I mine for. It might turn out I mined for the wrong one when a follow up block gets found for the other one first. With merged mining I can just mine for both and if I find a block, announce it for both chains, just in case. This can go on for 20 forks and so on. Prepare to see very long living forks! If I'm right with my conclusions, we will need some mechanism to counter this chain pollution.


Merged mining only works on block chains that are set up as a slave to another chain's master.

Namecoin uses Bitcoin as a master, but Bitcoin has no master.

So for sub-chains, you could presumably mine against any number of forks (at least, it doesn't strike me as immediately obvious that you could not), but not for Bitcoin.


Title: Re: merged mining implications
Post by: DeathAndTaxes on October 12, 2011, 01:32:10 PM
So for sub-chains, you could presumably mine against any number of forks (at least, it doesn't strike me as immediately obvious that you could not), but not for Bitcoin.

Someone correct me if I am wrong but namecoin is included in BTC block chain by using the coinbase field which is limited to 100 bytes.   Namecoin "header" in coinbase field uses 49 bytes making it impossible to fit 2+ complete namecoin hashes + BTC extra nonce value.  Also not sure if namecoin algorithm is flexible enough to accept BTC hashes where namecoin header "out of posistion".  I believe (but haven't verified) even if you included 2 namecoin hashes in the coinbase field the network wouldn't see the second one as valid.


Title: Re: merged mining implications
Post by: BitterTea on October 12, 2011, 01:39:32 PM
So for sub-chains, you could presumably mine against any number of forks (at least, it doesn't strike me as immediately obvious that you could not), but not for Bitcoin.

Someone correct me if I am wrong but namecoin is included in BTC block chain by using the coinbase field which is limited to 100 bytes.   Namecoin "header" in coinbase field uses 49 bytes making it impossible to fit 2+ complete namecoin hashes + BTC extra nonce value.  Also not sure if namecoin algorithm is flexible enough to accept BTC hashes where namecoin header "out of posistion".  I believe (but haven't verified) even if you included 2 namecoin hashes in the coinbase field the network wouldn't see the second one as valid.

Ah, I was not aware of that. Sounds like you're right and I'm wrong.


Title: Re: merged mining implications
Post by: giszmo on October 12, 2011, 04:36:34 PM
Your understanding is flawed.

Thanx for extending your post. Now I understand. Sorry for not having read more before posting.


Title: Re: merged mining implications
Post by: DeathAndTaxes on October 12, 2011, 07:50:51 PM
In hindsight it came off kinda harsh.  It wasn't intentional.  Sorry about that.  We are all here to learn.


Title: Re: merged mining implications
Post by: johnj on October 12, 2011, 08:21:12 PM
One very special implication:
* What if I receive a fork at my miner now? Until now I decide which one I mine for. It might turn out I mined for the wrong one when a follow up block gets found for the other one first. With merged mining I can just mine for both and if I find a block, announce it for both chains, just in case. This can go on for 20 forks and so on. Prepare to see very long living forks! If I'm right with my conclusions, we will need some mechanism to counter this chain pollution.


Merged mining only works on block chains that are set up as a slave to another chain's master.

Namecoin uses Bitcoin as a master, but Bitcoin has no master.

So for sub-chains, you could presumably mine against any number of forks (at least, it doesn't strike me as immediately obvious that you could not), but not for Bitcoin.

I believe there is support for a max of 32 subchains.

But don't quote me on it.


Title: Re: merged mining implications ... based on misconceptions ...
Post by: finway on October 13, 2011, 04:16:18 PM
namecoin deserve to live. 
merged mining saves namecoin.
merged mining ---brilliant idea.