# Mathematical Modeling

*The recipient waits until the transaction has been added to a block and z blocks have been linked after it. He doesn't know the exact amount of progress the attacker has made, but assuming the honest blocks took the average expected time per block, the attacker's potential progress will be a Poisson distribution with expected value:*

![](https://hub.bsvblockchain.org/~gitbook/image?url=https%3A%2F%2Flh4.googleusercontent.com%2F6TFqB5dJW9FnO7OjhLt0Qn_y-S8dqj_f_yf1fNsEvODDIAXGT-98S0BNy-iEUqE7rz34FpyxOZiNO0dz9zSKv-u1rh_fuhqdZqAno7zPVCqxUUtiSAxvdyphqfdAuKtbrLbShAi0\&width=300\&dpr=4\&quality=100\&sign=d93991b4\&sv=2)

*To get the probability the attacker could still catch up now, we multiply the Poisson density foreach amount of progress he could have made by the probability he could catch up from that point:*

![](https://hub.bsvblockchain.org/~gitbook/image?url=https%3A%2F%2Flh3.googleusercontent.com%2FGIoS6zRFrhU4TzPR-ZPPlaBJ9fXEK_hbWTY5yaVYridU3C-byhqNHGXxi9ym9NBiEKBpzJ654VUvMD9cU_8S8CgdB2RzsqBT5CUwvtfJ5LjSVBYcEY9TbEhfIlTxiWum5dBJvAnw\&width=300\&dpr=4\&quality=100\&sign=f70728fd\&sv=2)

*Rearranging to avoid summing the infinite tail of the distribution…*

![](https://hub.bsvblockchain.org/~gitbook/image?url=https%3A%2F%2Flh4.googleusercontent.com%2FM9gxyVuwPlrqN-OTSJNNCgQiobpFinZr-_EwXJny-jlKz2BmBhMB5ak6aLk36SYzcDLbevUNbHEYnykDv26CrWX2tJpszYKJW8Tb91EHi874kVI5NV00_FO0Ljw1CjLhpd7dwrOx\&width=300\&dpr=4\&quality=100\&sign=4eb9db49\&sv=2)

*Converting to C code…*

*#include double AttackerSuccessProbability(double q, int z) { double p = 1.0 - q; double lambda = z \* (q / p); double sum = 1.0; int i, k; for (k = 0; k <= z; k++) { double poisson = exp(-lambda); for (i = 1; i <= k; i++) poisson \*= lambda / i; sum -= poisson \* (1 - pow(q / p, z - k)); } return sum; } Running some results, we can see the probability drop off exponentially with z.*

![](https://hub.bsvblockchain.org/~gitbook/image?url=https%3A%2F%2Flh5.googleusercontent.com%2FJhEqcufv34aR951-kFZSoTvCnQQ1Wo8b3yoQI61rs5woXi8uohfCr2HTmvMQhmjwWgumUXSSX8wfJ7td94BpurslWwNsFTLVhTkLKmQKrGWvKHF70CHsYDG--hJ-8oPwD3cLNnPY\&width=300\&dpr=4\&quality=100\&sign=4f3c0262\&sv=2)

Satoshi Nakamoto, Bitcoin Whitepaper

<figure><img src="/files/ysz9x9LCyn3GT4RELQOR" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Q2eX86elcZrOEiLIZcHo" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/r7vUuus0HEOKEDfON53f" alt=""><figcaption></figcaption></figure>

The final part of this section concerns the probabilities of success an attacker might have given varying different quantities of hashpower with which to execute their attack. The first two charts show that for a given percentage of the network’s hashpower (10% and 30% respectively), the chance of ever catching up from a lead of more than just one block is probabilistically low, making the attack highly risky.

| Hash Power (%) | Lead (Blocks) | Probability of Catching Up |
| -------------- | ------------- | -------------------------- |
| 10%            | 1             | Low                        |
| 30%            | 1             | Moderate                   |
| 10%            | 24            | 0.1%                       |
| 30%            | 24            | 1%                         |

The third chart shows how many blocks lead represents a 0.1% chance of catching for a given % of hashpower. We can see that for anything below 30% of the hashrate, a lead of just 24 blocks can represent a 1/1000 chance.

These probabilities highlight the inherent risks associated with attempting a 51% attack, as the likelihood of success diminishes rapidly with increasing lead blocks.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-whitepaper-series/section-11-calculations-bitcoin-whitepaper/mathematical-modeling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
