Minor issue with z7


I notice that I can no longer expect to retain full functionality if I compile Zcash on one system and copy it to another unless I use an account with the same username on the target system.

The particular functionality that doesn't survive the transfer is the tests. While I was able to make a simple edit to re-enable the rpc-tests on the target system, I didn't have the same success with the full-test-suit.


A few things I thought were strange:

1) it takes at least 30 minutes before lsof and getinfo realize I have been disconnectde from internet. CPU and RAM usage stay strong.

2) my wallet balance is 50% bigger than what is showing in listoftransaction

3) difficultysetting keeps increasing even when I am disconnected from internet and no new blocks are being found. It goes slowly up and then drops back down to 0.


Have you noticed a slow down in coin acquisition rate? I got 200 two nights ago and 20 last night. Another strange thing is that both blocks that gave me the 20 were solved within 1 minute after waiting 6 hours. Apparently, the time to my second block solve was not a random event, independent of the previous coin.


The reason ist that the difficulty is raised to 29.4! Maybe someone got the "golden" formula with his gpu miner... :rage:

Edit: Now the diff is dropped to 1.5.
Edit 2: now 10.9.
Edit 3: now 27.2.


That was not it. The difficulty is sawtoothing and the seconds to solving a block are about 6*Difficulty+40. If the average difficulty increased from 5 to 15, my personal time to solve is only twice as long, not 10x as long, if the number of people were roughly the same.

Even after finding my error, how can it be 2 hours without a block then 3 in 5 minutes? Then 45 minutes nothing followed by 6 in 20 minutes? I thought the time to solution was based on a random variable (if network and difficulty were constant).


My guess is that it's harder to fine tune difficulty to result in blocks that consistently appear at a set interval when there are fewer participants.


Part of the weirdness of two blocks right behind each other could be the classroom birthday effect. 24 students in a room have a 50% chance of being born on the same day. If I have 4 threads that on average find a block in one hour, then in some sense after 6 hours there will be 24 possible birthdays. It's not quite like that but maybe it's not too far off. There are 360 minutes in 6 hours, like the days of the year, so there might be a 50% chance 2 blocks will be solved in the same minute every 6 hours.


There was a bug introduced when the difficulty algorithm was changed. On the testnet, if more than twice the target block interval has passed, a min-difficulty block is permitted (this is unchanged from Bitcoin). However, the next adjustment was then readjusting from that min-difficulty block instead of the previous difficulty. This is fixed in z7 and will hardfork on at block 43,400 (which should occur a few hours from now).


I've installed z7 fresh and it looks like a sawtooth, going up one step with each block, something like 1.085^N but changing the 1.085 based on something, then dropping all the way back to 1 after reaching some peak, like 10 to 60. I assume it's calculating an average block-found rate as it is climbing, which determines when it drops back down. k^N fits good, R^2=0.98


If you want to see exactly what it is doing, here is the code :smile:


Thanks. You say it's fixed, and that's the code I see in my install. But I also see it collapsing back to 1 every time a block takes 5 minutes.


You missed the second part of my previous comment: the fixed behaviour will turn on at block 43,400, which should be some time in the next hour or two (I haven't checked where we are up to).

EDIT: We are currently at block 43,445 so the new rules should be active.


I read that several days ago where you wrote it in the ticket, and then again in the code. All 3 times I thought "is fixed" meant it is fixed from a user's perspective of how the program runs, not from a programmer's perspective of "task is completed".


Changes to difficulty rules are effectively changes to consensus rules, and thus need to be fixed (from the user's perspective) with a fork rather than just a software release.


FWIW, mine is showing block 43384.

What prevents me from changing difficulty setting on my PC?


Aha, I must have previously read the tx field as the block height :sweat_smile: Just hit block 43,401 here!

The difficulty setting is not something you can set yourself. It is a property defined by the blockchain, and is the same for all miners.


"difficulty" : 204.86499621

I've just complied z7 and saw the difficulty, not long ago when I was testing z6 it was 0.00000001 or so. Do we really have so many people testing Zcash? Or someone is testing his botnet with Zcash?


You can't compare the current difficulty to z6, because z6 had the bug I outlined earlier in this thread where the difficulty was being perpetually reset.