# Application of Graph Theory for Blockchain Technologies
## 5 Graph Theory Application in Blockchain Systems
### Evaluating Security and Privacy
#### 5.2.2 Threat Modelling
:
* Let \(W_{T}\) be the total network hash rate, computed as the sum of weights of all outbound edges in \(G\): \[W_{T}\ =\ \sum_{e\in E}w(e)\]
* An attacker controls a subset of nodes \(V_{A}\). Let \(W_{A}\) be the hash rate controlled by the attacker, calculated as: \[W_{A}\ =\ \sum_{v\in V_{A}\ \epsilon\ \text{outbound from}\ v}w(e)\]
* For the attacker to perform a 51% attack, \(W_{A}\) must be greater than half of \(W_{T}\): \[W_{A}>\frac{W_{T}}{2}\]  
This would enable the attacker to:
* Prevent transaction confirmations: By choosing not to include them in the blocks they mine. * Halt payments: By ignoring blocks containing certain transactions, preventing them from being confirmed. * Double-spend coins: by creating a private fork of the blockchain and then releasing it to replace the previously agreed-upon blocks. The control of the majority hash rate allows the attacker to have the longest chain, which is considered the valid chain by honest nodes, thus enabling them to manipulate the blockchain. Figure 12 illustrates a 51% attack scenario on a blockchain network, which is characterized by a single entity--the attacker--having a majority control over the network's mining power. Nodes, labeled as \"Miner_x\" represent individual mining participants in the blockchain network. The node labeled as \"Attacker\" represents the entity that has gained control over a significant portion of the network's mining power. Edges from the \"Attacker\" node to the \"Miner\" nodes indicate the direction of control or influence. It implies that the attacker has a direct or indirect influence over the individual miners, possibly because they are part of a mining pool controlled by the attacker or are malicious nodes themselves. The \"Miner\" nodes are colored blue, which could represent normal miners in the network. The \"Attacker\" node is colored red, a common color to signify danger or a warning, in this case representing the malicious entity conducting the attack. The \"Attacker\" node is significantly larger than the \"Miner\" nodes, representing its larger hash rate relative to the individual miners. The graph theory-based model conclusively demonstrates that if an entity can accumulate more than half of the hash rate in a blockchain network, it possesses the capability to undermine the network's integrity. This proof highlights the intrinsic security risks within proof-of-work blockchain systems and highlights the necessity for distributed and balanced hash rate distribution to safeguard against 51% attacks. Through the lens of graph theory, we have explored a variety of attack vectors: phishing attacks that lead to private key theft, 51% attacks that compromise the integrity of the blockchain, DDoS attacks that overwhelm network resources, and DNS and BGP hijacks that reroute traffic to compromise data integrity and availability. Threat modeling is an indispensable part of designing and maintaining secure blockchain networks. It not only aids in identifying and understanding potential threats but also in developing comprehensive strategies to mitigate such risks and ensure the continuity, integrity, and trustworthiness of blockchain systems.