BitMaker-hub / NerdMiner_v2

Improved version of first ESP32 NerdMiner
Other
1.37k stars 249 forks source link

output of sha256d seems wrong #444

Open betterpony opened 4 days ago

betterpony commented 4 days ago

On branch master in file mining.cpp ESP32s3R8,has in-Package PSRAM and 16M external Flash

I log the ‘header64’ and it's sha256d output 'hash',it's seems that only the 4-bytes of the hash string changed each sha256d turn,the 'a5a5a5...' ,maybe 'hash[32]' not initiate I think, as blow: 企业微信截图_17199978985261

Then: I jump to the implement of ‘nerd_sha256d’ ,end of this function,I see something as blew: image What's the purpose here,why return when doubleHash[31] !=0 || doubleHash[30] !=0,it's not a Standard sha256d output。

Look forward to your reply

BitMaker-hub commented 3 days ago

Hello!!

You made me think a little on this function and see it can be even improved a little bit the hashrate, Thanks! haha

Printing every iteration doesn't make sense because we are only considering those shares who have at least 2 double words with zeros. This was done because any share below this difficulty will be really low (even the actual ones too, hehe)

Soo... This was done just to be faster on each iteration of nonces. Then, if you want to print every share transmitted to pool just print these ones that returns true (so they are a 16bit share)

betterpony commented 1 day ago

Thanks

I have figured it out before your reply via read your logic carefully ,it's a great idea to burst the hash rate I think.

By the way,something I didn't understand about the difficult from pool and default_difficult = 1e-4 in Macro definition:

1. Job from “public-pool.io” is solo mining job or pool mining job? 2. If it's a solo job,why we always push ‘mining.suggest_difficulty’ = 1e-4 to pool , I'm not sure if the following description is correct or not? In solo mining job, we should search for a suitable nonce based on the difficulty value specified in the solo job, such that the hash value of the block header + nonce is less than the difficulty target in the job. This difficulty target should be the BTC network-wide difficulty target。So I think the pool may not accept we suggestion(=.=) 3. If it's a pool job, why pool didn't reject we 32-bits share ? It's seems that if there 32-bits zero hash exist,you just try to submit the nonce,but the nonce is not suitable for the pool difficult。Is there are some simplify method for nonce share? just like your 32-bits 0 is enough(haha..)

Things above made me confuse some days($.$)

Thanks again my bro.