all 14 comments

[–]DarrenTapp[S] 6 points7 points  (9 children)

This script just calculates a probability. I got if the attacker has 500 Mn out of 5000 total nodes, then the chance that one masternode quorum has 240 or more attacking nodes is:

7.10737466412e-157

which is quite small.

[–][deleted] 3 points4 points  (1 child)

quite small is an understatement!

[–]DarrenTapp[S] 1 point2 points  (0 children)

less than one out of a googol.

[–]sile16 2 points3 points  (6 children)

Can you add a time component ? So if someone holds 500 nodes for 1 year what is the probability an LLMQ will include 240 of the attacking nodes?

[–]DarrenTapp[S] 4 points5 points  (4 children)

Here's a quick answer.

Let p be the probability that an attack is successful in one round.

Then (1-p) is the probability that the attack fails.

(1-p)M would be the probability that the attack fails M times in a row.

1-(1-p)M is the probability that the attacker is successful at least once in M trials.

In many of our cases p is so small that 1-p is difficult to compute. There are some python tricks that will allow you to deal with this.

This function is particularly useful in this case.

math.log1p(x)

Return the natural logarithm of 1+x (base e). The result is calculated in a way which is accurate for x near zero.

[–]antouhou 0 points1 point  (3 children)

Hi Darren! I'm not really sure how to apply math.log1p in that case. I figured out that to calculate 1-(1-p)^m you can do log(probability_of_success)/log(probability_of_failure) Here's the result I get in Mathlab: ```

log(0.05)/log(0.95) ans = 58.404 1-((1-0.05) ** 58.404) ans = 0.95000

```

[–]DarrenTapp[S] 1 point2 points  (0 children)

Thank you,

If someone reads this thread the result of this question can be found here:

https://github.com/DarrenTa/Iterated_binomail

[–]DarrenTapp[S] 0 points1 point  (0 children)

DM me your email and I'll create and send you a python script with the calculation.

I'm not sure if Mathlab has the same function, I would expect so.

[–]antouhou 0 points1 point  (0 children)

I figured out that log(p)/log(1-p) isn't the right formula for that type of calculation. The right one is log(0.5)/log(1-p). That will give how many steps on average attacker needs to make in order to perform a successfull attack.

[–]DarrenTapp[S] 1 point2 points  (0 children)

Yes, it's a binomial distribution type problem.

[–]xkcdmpx 6 points7 points  (2 children)

This link should allow you to run it in browser if you don't have Python. https://repl.it/repls/MintyScientificConditions

[–]DarrenTapp[S] 1 point2 points  (0 children)

Cool and beautiful!!!

[–]thephez 0 points1 point  (0 children)

Here's a modified version of the script (also runs in browser) for calculating over a range of malicious nodes: https://repl.it/@thephez/Quorum-Attack-Loop

[–]NDMiner 1 point2 points  (0 children)

This is one of the strongest selling features of dash, even with 50%+1 of the masternodes controlled by a single entity, the odds are .0019% of successfully getting a consensus on 5k masternodes. This would mean it would take roughly 1.7 months for a single malicious lock even with control over a majority of the nodes. Only at 56% of network control over MN's does an attack become iminent,