Skip to main content

Merge Mining

Bitmark supports Auxiliary Proof-of-Work (AuxPow), enabling simultaneous mining with other compatible blockchains.

Overview

Merge mining allows miners to use the same proof-of-work to secure multiple blockchains. A miner working on a "parent" chain (like Bitcoin or Litecoin) can simultaneously create valid blocks for Bitmark.

Benefits

  • Increased Security: Leverage parent chain's massive hashrate
  • Miner Efficiency: Mine multiple coins with same hardware
  • No Extra Cost: Parent chain mining continues normally
  • All Algorithms Supported: Works with all 8 Bitmark algorithms

How It Works

AuxPow Structure

Block Version Flag

AuxPow blocks are indicated by bit 8 in the version field:

#define BLOCK_VERSION_AUXPOW (1 << 8)  // 0x100

// Check if block is AuxPow
bool IsAuxPow(int nVersion) {
return nVersion & BLOCK_VERSION_AUXPOW;
}

AuxPow Data

FieldDescription
coinbaseTxParent chain coinbase transaction
hashBlockParent block hash
vMerkleBranchMerkle branch linking coinbase to merkle root
nIndexIndex in merkle tree
vChainMerkleBranchChain merkle branch (for multiple aux chains)
nChainIndexChain index in auxiliary merkle tree
parentBlockComplete parent block header

Chain ID

Bitmark uses a unique chain ID to prevent cross-chain confusion:

// Chain ID for Bitmark
static const int AUXPOW_CHAIN_ID = 0x005B; // 91 decimal

// Version includes chain ID
int nVersion = BLOCK_VERSION_AUXPOW |
(AUXPOW_CHAIN_ID << 16) |
(algo << 9) |
baseVersion;

Merge Mining Marker

The parent chain coinbase must contain the merge mining marker:

0xfa 'b' 'e' 'm' 'm'  (5 bytes: 0xfa62656d6d)

This marker indicates that the coinbase contains auxiliary chain commitments.

Algorithm Compatibility

The parent chain must use the same algorithm as the Bitmark block being mined:

Bitmark AlgorithmCompatible Parent Chains
SCRYPTLitecoin, Dogecoin, etc.
SHA256DBitcoin, Bitcoin Cash, etc.
YESCRYPTCoins using Yescrypt
ARGON2DCoins using Argon2d
X17Coins using X17
LYRA2REv2Vertcoin, etc.
EQUIHASHZcash, etc.
CRYPTONIGHTMonero (original), etc.

Validation

AuxPow Block Validation

bool CheckAuxPow(const CAuxPow& auxpow, int algo) {
// 1. Verify merge mining marker exists
if (!auxpow.HasMerkleBranch()) return false;

// 2. Verify chain ID matches
if (auxpow.GetChainId() != AUXPOW_CHAIN_ID) return false;

// 3. Verify parent block meets difficulty
uint256 parentHash = auxpow.parentBlock.GetPoWHash(algo);
if (parentHash > auxpow.GetTarget()) return false;

// 4. Verify merkle proofs
if (!auxpow.VerifyMerkleBranch()) return false;

// 5. Verify coinbase contains Bitmark header hash
if (!auxpow.CheckMerkleBranch(hashAuxBlock)) return false;

return true;
}

Security Checks

  1. Chain ID: Prevents using work from other merged coins
  2. Algorithm Match: Parent must use same PoW algorithm
  3. Merkle Proof: Coinbase must properly commit to aux block
  4. Difficulty: Parent block must meet Bitmark's difficulty

Mining Setup

Pool Configuration

For mining pool operators:

// In block template generation
if (isMergeMining) {
// Include Bitmark header hash in coinbase
std::vector<unsigned char> auxData;
auxData.push_back(0xfa);
auxData.push_back('b');
auxData.push_back('e');
auxData.push_back('m');
auxData.push_back('m');
auxData.insert(auxData.end(),
merkleRoot.begin(), merkleRoot.end());

coinbase.append(auxData);
}

Miner Configuration

For individual miners using compatible pools:

# Pool must support Bitmark merge mining
# No special miner configuration needed beyond
# connecting to a merge-mining pool

RPC Support

getauxblock

Request an auxiliary block template:

bitmark-cli getauxblock

# Response includes:
# - hash: The aux block hash to be solved
# - chainid: Bitmark's chain ID
# - target: Current difficulty target

submitauxblock

Submit a solved auxiliary block:

bitmark-cli submitauxblock <hash> <auxpow>

Example Version Numbers

DescriptionnVersion (hex)nVersion (decimal)
Scrypt, no AuxPow0x000000044
SHA256D, no AuxPow0x00000204516
Scrypt with AuxPow0x005B01045,963,012
SHA256D with AuxPow0x005B03045,963,524
LYRA2REv2 with AuxPow0x005B0B045,965,572
Equihash with AuxPow0x005B0D045,966,084

Security Considerations

Parent Chain Trust

  • Parent chain security doesn't directly affect Bitmark
  • Only the work proof is used, not consensus rules
  • Parent chain forks don't cause Bitmark forks

Difficulty Independence

  • Bitmark maintains independent difficulty
  • Merge mining doesn't reduce security
  • Actually increases security via additional hashrate

Attack Resistance

Merge mining attack vectors:

  1. Parent 51%: Doesn't help attack Bitmark
  2. Fake AuxPow: Detected by merkle proof validation
  3. Wrong Algorithm: Rejected by algorithm check

Implementation Files

FilePurpose
src/auxpow.hAuxPow structure definitions
src/auxpow.cppAuxPow validation
src/core.cppBlock version handling
src/rpcmining.cppgetauxblock RPC

History

  • Block 0: Genesis, no AuxPow
  • Block 450,947: mPoW fork, AuxPow enabled for all algorithms

See Also