The getmemorypool RPC command lists all transactions that are to be included in a block, with the exclusion of the generating transaction. In merged mining, one needs to add an extra transaction containing the hash of a Namecoin block to be generated.

If one uses the source code provided from the Namecoin wiki, how would one merged mine? Is the metmemorypool transaction be supported? Would the special Namecoin transaction be included in the listed transactions?

Most of what you need is explained at https://en.bitcoin.it/wiki/Merged_mining_specification

When you construct the block for the primary chain (e.g. bitcoin) you need to include a merged mining header in the generation transaction (coinbase). The format of this data is explained at the URL above under "Merged mining coinbase".

If, while hashing the primary chain, you get a hash that is below the target for the auxiliary chain (e.g. namecoin) you can create a block on that chain using getmemorypool (assuming the daemon for that chain supports getmemorypool).

To submit a merged mining block, for namecoin you need to do two things that you wouldn't do when mining non-merged.

The first is to set the auxpow bit in the version field of the block header.

BLOCK_VERSION_AUXPOW = (1 << 8)

The second difference is that you insert an auxpow between the header and the transactions. The binary layout of the auxpow is explained at the URL above under "Aux proof-of-work".

The auxpow bit in the version field tells namecoin that after the block header there will be an auxpow before the transactions.

In theory other alt coins may need to have their merged blocks formatted differently and/or submitted differently to their daemon.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.