On dual PoW, Graph rates, gps, and Difficulty

With two different PoWs, and a time varying balance of block rewards between the two, Grin is not your average blockchain. This post will try to relate the network difficulty to the various Graph rates, in units of graphs-per-second. For simplicity, we’ll pretend that the primary PoW is is just Cuckatoo31, i.e. no-one is mining Cuckatoo on graphs with more than 2^31 edges.

In order to solve a block, you pick either PoW, and you pick a nonce, which, together with the rest of the header, determines a graph.

In this graph you then look for a 42-cycle. You need some luck here, since the expected number of L-cycles in a random graph is 1/L. Once you find a 42-cycle, you compute the cyclehash, which is the hash of the (sorted) 42 edge indices.

Now, in the hashcash PoW of most other coins, you would test whether this hash, interpreted as a huge 256-bit number, is below a target, in which case you solved the block. The difficulty is inversely proportional to the target, so higher difficulty corresponds to lower targets (you can see that it’s harder for a random hash to fall below a lower target).

In Grin we use difficulties directly, and skip the notion of a target. We convert the cyclehash into a solution difficulty, and test whether this is at least the network difficulty. The conversion depends on the choice of PoW though.

For the primary Cuckatoo31, the solution difficulty is the weight of 2^31 edges, 7936, divided by the cyclehash interpreted as a fraction in the interval (0,1).

For the secondary Cuckaroo29, the solution difficulty is the secondary scale, divided by the cyclehash interpreted as a fraction in the interval (0,1).

Again we have that the smaller the cyclehash, the higher the solution difficulty, and the more likely we pass the difficulty test.

With Cuckaroo29, the likelihood is also proportional to the secondary scale. This variable acts like a control knob, that is used to either dial up or dial down the rate of blocks solved by the secondary PoW, in order to achieve the desired balance.

And now for some math. Denote

PR31 = Primary Rate = global rate of Cuckatoo31 graphs per second
W31 = weight of a Cuckatoo31 graph = 31 * 2^8 = 7936
SR29 = Secondary Rate = global rate of Cukatoo29 graphs per second
S29 = ar_scale = secondary scale = variable scale of a Cukatoo29 graph
BR31 = rate of primary blocks
BR29 = rate of secondary blocks
ND = Network Difficulty

We have BR31 = (PR31 / 42) * (W31 / ND), BR29 = (SR29 / 42) * (S29 / ND),
for a combined block rate of BR31 + BR29 = (PR31 * W31 + SR29 * S29) / (42 * ND) which should ideally equal 1/60. So assuming the system has achieved equilibrium, we have

ND = (60/42) * (PR31 * W31 + SR29 * S29)

and at launch, when the secondary reward rate should be 90%, we have

(SR29 * S29) / (PR31 * W31) = 90% / 10%

This allows us to compute graph rates from network difficulty, secondary scale, and the current reward balance:

SR29 = ND * (42 / 60) * 90% / S29

PR31 = ND * (42 / 60) * 10% / W31

Also see the related post https://forum.grin.mw/t/what-to-mine-choosing-between-cuckatoo31-and-cuckaroo29

5 Likes

Great and clear explanation. Thank you, tromp.

and is the expected srs (the secondary reward rate) decreasing in the below way ?
srs = max(0, 90 - int(height / NUM_BLOCKS_WEEK)), which NUM_BLOCKS_WEEK = 7 * 60 *24

No, the reward balance function is at

@tromp Does the formula SR29 = ND * (42 / 60) * 90% / S29 get affected by the fact that AR29 is being awarded like 98% of blocks right now?

You say assuming the system has achieved equilibrium does that mean the hash formula is inaccurate right now?

The system has clearly not reached equilibrium yet, with ar_scale on a downward trajectory to improve odds for Cuckatoo31 miners. So right now we have almost

SR29 = ND * (42 / 60) * 100% / S29

as the primary contribution is negligible…

1 Like

Thanks tromp. That’s what I was thinking but my coworker seemed fairly certain you should still use the constant NOT the observed secondary award rate

Since there are no ASIC’s, the rewards should reach an equilibrium where the $/day for a GPU will be the same whether you mine Roo or Too. There might be a small premium on Too since fewer cards can mine it right now, which creates some friction. But I expect the 90/10 idea to disappear with GPU market dynamics. It will mostly level out on a $/day per GPU basis.

I don’t think that’s right, I agree the pheasbility will balance, but I do think 90/10 will still work because it will get harder to mine AR29 until the payout is the same. So you’re right except that we should still settle in at 9/10

I think we’re saying the same thing? The payout for any given GPU won’t be much different. If C31 is 10x slower, the difficulty will adjust until it has 10x the rewards. The 90/10 in the code simply means the “absolute” payouts will go to 90/10 based on the adjustment of network difficulty, but the market will adjust its hashrate until GPU profitability is the same for either PoW. Maybe C31 gets a little more like I said because not all GPU’s can mine it, therefore GPU’s that are good at C31 can get a premium on the payout.

1 Like

Sounds like it. The thing that threw me off was when you said “the 90/10 idea will disappear with gpu market Dynamics”. I don’t think they ever expected that to represent profitability, just the intended number to be awarded. The profitability will in some sense go up when the 9:1 ratio approaches 0:10 but the miners will adjust by mining more AR31 so that profitability remains close.

It could get a lot more if for instance the 2080Ti hashpower is only 4% of the total. In order for them to take 10% of all rewards means that they enjoy a 2.5x premium. And the 1080ti, which is maybe 3x less efficient at C31 would still be better off sticking with C29.

I guess I speculate these giant farms might just upgrade (to 2080tis)- but a lot of them probably use exhisting infrastructure they have from mining other things

Only after evaluating performance of the new 16 GB Vega…

This would only be temporary. History shows that these discrepancies in the GPU market don’t last longer than 3 months, which is about the time for the GPU supply chain to react. The market for 1080Ti’s right now is ridiculous and constrained. If AMD releases that 16GB card in February…

I think the C31 premium could evaporate even faster as we see better C31 miners released that work on a wider variety of cards.

Nvidia cards are simply overpriced and I rarely hear of them being used in big farms. Nvidia targets the high-end gaming market, and AMD is the better value option. When you’re mining, margins are thin, and cheap is the way to go. From the current stats, the good ol’ 480’s and 580’s are currently the best $/H on capex, but I haven’t measured power.

Re AMD’s Radeon VII

TweakTown has reported that fewer than 5000 Radeon VII GPUs will be hitting the shelves come launch day, mid summer this year. According to its source, AMD will be making a net loss on each GPU sold to the consumer, as these are effectively just redeveloped M150 GPU accelerators originally designed for enterprise and data center use.”

I tried with 31 in the first 16 hours, results was not promising. I’m using Tesla-P40 with more than 12GB memory on the GPU. Due to the total blocks generated was very rare, so what I’ve got is also low.

Would the 16GB and and 1TB of memory bandwidth give Vega 2 a major performance advantage over the 2080TI?

To be clear, we’re talking about a theoretical premium on C31 that doesn’t exist yet. The two difficulties have not found market equilibrium yet…

1 Like

So please make it clear for dummies: is there any reason to try mining on Cuckatoo 31 algo with GTX1070 GPUs? Will it be better for the network? Wil it be better in terms of miner’s profit?