ASICseer mines BCH exclusively with its development fee. In preparation for the BCH halving, we built out an ability to switch between BCH and BTC mining (ultimately, our company must behave profitably). We wanted to go back to BCH mining, but it seemed that BCH profitability was reduced despite supposedly having equalized between the two chains. I started doing some investigation.
I bought coinwarz API access and started logging BCH difficulty, trying to get some real data in the hopes of building out a switching algorithm for internal use.
I figured that I'd take the median value of the last 24 hours. If difficulty was below that value, we'd mine BCH. If difficulty was above that value, we'd mine BTC. A few things came to light:
- I found conclusive proof that the DAA is being gamed.
- I realized the immediate solution to this problem.
This screenshot shows that, anytime the difficulty drops to around 60-70% of the median difficulty value over the past day, pools that have both BTC and BCH endpoints end up finding a disproportionate amount of blocks (as high as 25 blocks per hour) instead of the expected amount of six blocks per hour. In fact, these pools wait until the lowest possible difficulty to do that.
So, I began to think: "How can we, as honest miners, prevent this occurrence?" With this question in mind, I built out bchdiff, a JSON API that samples BCH difficulty over the last 24 hours and presents the data in an easily-digestible manner.
The trigger for is_bch_diff_low
is set to return yes
when current_divided_by_median
is <= 0.99 (99%). With this API, you can mine BCH whenever the difficulty starts to recede. With enough people and enough hashrate, use of this API would prevent crazy oscillations, and would remove the profit motive for pool cartels. The difficulty would never drop to 70% of its median value, and pool cartels would not be incentivized to bring exahashes of BTC hashrate onto the BCH chain.
Please note: this is not a profit switching algorithm, it is a difficulty switching algorithm. Use of this API will increase the net amount of mined coins/time and will stabilize the BCH chain as a side effect. Profitability never figures into the equation. Finally, and this must be said: If you feel that you're "abandoning" BCH or something equally frivolous, you should not feel that way. I expect you to buy BCH with the BTC that you mine.
Here is an example (with caching) for instructions on how to use this API. This example showcases ASICseer's remote config system, but you don't need ASICseer to use this API. Basically, you would need to specify your BCH and BTC pool endpoints and switch between them depending on the value of is_bch_diff_low
(you can also do your own math if 99% of median is not to your liking). If you are experienced with either solo mining or running a pool, this should be relatively easy to implement.
[link] [comments]
source https://www.reddit.com/r/btc/comments/g0axm3/the_bitcoin_cash_difficulty_adjustment_algorithm/