Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Equihash difficulty calculation #194

Description

@saltyminer

I am working on adding HUSH coin support so I can contribute to the project. I have the pool running on MAINNET and TESTNET successfully using the ZCLCoinbaseTxConfig (no founders reward). The difficulty calculated in the init of the ZCash job using the BlockTemplate Target vs the difficulty of submitted shares seems to be incorrect. Below is a scenario from debugging.

In the ZCashJob.Init the following line is calculating the difficulty as 8.038809381260992E+58

Difficulty = (double) new BigRational(ZCashConstants.Diff1b, BlockTemplate.Target.HexToByteArray().ToBigInteger());

BitcoinJob Manager is then setting the job network difficulty to the same value in the BitCoinJob.UpdateJob method here:

BlockchainStats.NetworkDifficulty = job.Difficulty;

In order to submit shares in a timely fashion I need to set the config.json as follows

"ports": {
	"3097": {
	  "listenAddress": "0.0.0.0",
	  "difficulty": 0.1,
	  "varDiff": {
		"minDiff": 0.1,
		"targetTime": 15,
		"retargetTime": 90,
		"variancePercent": 30
	  }
	},
	

When shares are submitted the share difficulty is averaging around 0.5 vs the network difficulty that was calculated by the job of 8.038809381260992E+58. As a result payouts are never calculated since the shares submitted in the PPLNS window have too low a difficulty to accumulate a score. I could manipulate the PPLNS factor or change the share multiplier, but I suspect the difficulty is not being calculated correctly from the block template target.

I ran some tests using ZCash on the MAINNET and TESTNET and I see similar calculations. When testing with Lyra2Rev2 for VTC and MONA the difficulty calculations for MONA and VTC both appear correct or at least more reasonable. Am I missing a parameter in config.json for Equihash? Is the target difficulty being calculated correctly? Would this impact finding a block?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions