Comments (12)
For that last graph, what did you use for LWMA window size? I think you need more than 144 to match the same 'averaging material' as SMA-144. A factor of 2x longer would be needed to keep the largest weight (the most recent block) the same. Or, you can try to just match variance in which case sqrt(2) longer would be enough.
from difficulty-algorithms.
@markblundeberg It was N=60. Your math is good because I had noticed SQRT(2) does actually give about the same std dev for constant hashrate. I'll make it a little higher at N=220. The spreadsheet I used for the above can't do the N=220 for LWMA, so I have to use a different method.
Expanded out some is below. The blank at the beginning is a startup, 2*N.
from difficulty-algorithms.
Here's a newer image to show the BCH miner motivations better.
from difficulty-algorithms.
Neat! It seems quite clear that the steady miners aren't being punished nearly as much in LWMA. So:
- LWMA-220 has about equal statistical power as SMA-144 (OK slightly better, it would be equivalent for LWMA-203 :-) ). In a fully steady hashrate condition (majority-chain) they should show equal fluctuations and essentially be indistinguishable.
- In conditions of opportunistic switch mining (minority-chain), LWMA is much much better in fluctuation amplitude. Also it doesn't create a runaway economic incentive problem for steady miners.
- Note that LWMA-220 actually responds to changing externalities (halving events, price changes) faster than SMA-144. We can see this in the weighting coefficients of recent blocks: 0.009 for LWMA-220, versus 0.007 for SMA-144.
from difficulty-algorithms.
An interesting aspect is that BTG with LWMA N=45 is a lot more stable in difficulty than smaller coins with LWMA N>60 because it is more liquid and big miners are more keen to mine it when difficulty drops a little low, preventing it from dropping lower, and leave if it get a little high, preventing it from getting higher. Std Dev in difficulty with N=60 with constant hashrate modeling is about 0.13. In BTG it is about 0.09.
I was remembering wrong. Std Dev in difficulty is the same when N is the same.
Under attack conditions, you can see the Std Devs decrease
In the text above the images you can see my start and stop conditions were they being when the difficulty is 30% above the difficulty that "dedicated" miners would have had, and stops when it's 35% above. That could use some tweaking to be more like BCH's current conditions.
from difficulty-algorithms.
The code that did these is "test_DAs.cpp" in my code area.
from difficulty-algorithms.
I was remembering wrong. Std Dev in difficulty is the same when N is the same.
Interesting, I hadn't actually done the math and was making an educated guess. Still it seems odd to me, I will do the math now. :-)
from difficulty-algorithms.
Oh OK, did the math now, it should be
LWMA-N stddev: sqrt((4/3) / N)
SMA-N stddev: sqrt(1 / N)
So if I have it right now, it's only a sqrt(4/3) factor, not sqrt(2). Note that I'm assuming big-N limit: this is based on calculating the variance in the average solvetime only, assuming the difficulty is reasonably constant (so solvetimes are IID); also I've approximated terms like N+1 as N.
I don't know why in your case the standard deviations are so much closer. 🤔 Perhaps the next-order term inside the square root, of order 1/N^2, is significant even at N ~ 144. Also though your sample size isn't huge, could just be the noise.
Anyway this makes it even better for my last point, which is that LWMA is more recent-responsive (2/N) than SMA (1/N), even for equivalent variance (e.g., LWMA-192 vs SMA-144, if I have the math right).
from difficulty-algorithms.
Difficulty is a recursive equation, so I have not dared attempt it. 100,000 runs on 192/144 gives 0.072 vs 0.086 and 0.73 and 0.82 on second run of 100k. Equal N still gives really close results at 100k.
from difficulty-algorithms.
Your difficulty algorithm might be to LWMA what LWMA is to BTC's crappy algo. I'll do an article on it sometime.
from difficulty-algorithms.
Haha, I am honored you say that. I thought it was just a funny toy algorithm but yeah it has some interesting properties.
from difficulty-algorithms.
I expected LWMA to be equally stable at around 200 because I had noticed that LWMA at 60 has same stability as SMA at N= 45 which is what your results are predicting. Next time I do a comparison
I need to look for any possible I may have made..
from difficulty-algorithms.
Related Issues (20)
- Detecting & Empowering Dedicated Miners In 51% Attacks
- Self-Hashing Transactions to Generate Coin
- Smooth Coin-Emission Formula
- Correcting Chain Work
- Importing Chain Work with Notarizations HOT 2
- New Selfish Mining Attack?
- ASERT / NEFDA is the perfect DA? HOT 22
- EMA for BCH (part 2) HOT 159
- Confirmation time, long averaging windows, a history
- Quantifying the Consensus Trilemma
- Verge Attack, February 15, 2021 HOT 1
- Multishield's geometric mean to get chain work in Multi-POW coins
- Easier-to-remember Seed Words HOT 3
- Installation HOT 3
- WTEMA / ASERT as an RC filter
- what is latest solution for Lwma? HOT 6
- Difficulty algorithm for interesting hashes instead of lowest target
- Maybe you can help me with go Implemetation this version of lwma HOT 1
- Best Difficulty Algorithm, Timestamp Rules, Selfish Mining, Selecting N
- Estimating Chain Work Based on Lowest Hashes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from difficulty-algorithms.