Huntercoin uses dual proof-of-work algorithm — SHA-256 and Scrypt. Both support merged-mining (e.g. with Bitcoin and Litecoin respectively). Chain IDs for merged mining are 6 Older beta-versions were using ChainID = 5 for SHA-256d, but this conflicts with GroupCoin (for SHA-256) and 2 for Scrypt).
Difficulty computation is similar to PPCoin's PoW/PoS approach, except that here we have PoW/PoW. Target block rate for each algo is 1 block per 2 minutes, giving the average of 1 block per minute for both algos combined.
Considering that most coins are generated and collected within the game, rather than from block reward, the dual-algo approach is intended to provide a smoother gameplay. In a single-algo scenario a big merged-mining pool stopping to mine will lead to a big slowdown of the game (e.g. by a factor of 10). With the dual algo a single pool can only cause slowdown factor of 2 (assuming that the pool mines only one algo). Also the overall hashpower of the coin increases when using two merged-mining algos.
Mining each algo is transparent, assuming you mine only one algo at a time. The algo is specified in the .conf file as
(can also be specified in the command line, i.e. -algo=scrypt). Default is sha256d.
All algo-related RPC commands (e.g. getdifficulty) will use the specified algo. getinfo shows three difficulties:
- difficulty_sha256d — SHA-256d
- difficulty_scrypt — scrypt
- difficulty — one of the above, depending on the algo setting in .conf file
Currently it's not possible to mine both algos using the same instance of the daemon. To fix this one of the following approaches should be implemented:
- Two different RPC ports for the two algos
- Two different rpcuser/rpcpassword pairs
- A new parameter for every mining-related RPC command (e.g. getwork <algo> ...)
- Two separate versions of every mining related RPC command (e.g. getwork-scrypt, getwork-sha)
Block algo is encoded in the nVersion field, as well as the ChainID for merged-mining. nBits field contains difficulty data for that algo. We could create two nBits fields (each algo will update its own nBits and copy the other algo's nBits), but this will change the block format and break merged mining with other coins, as they expect a standard 80-byte block headers. Instead, a recursive lookup is done into the block chain to find the previous block of the same algo (exactly like PPCoin's PoS/PoW).
Initial difficulties are set in the ratio 1:4096 (2^12), which is the ratio of initial difficulties of Bitcoin and Litecoin. The same ratio is used when computing the total chain work (bnChainWork field in the block index). It is hard to find the optimal ratio, because the two algos use different hardware and have different userbase. However, the ratio for bnChainWork can be changed in the future without hard-fork and will only require re-indexing of the existing blocks.