This Python program simulates a PoW blockchain network with various nodes, measures the blockchain's growth rate, and evaluates the impact of malicious nodes and attacks on the network.
This project provides a Python simulation program to model a PoW blockchain network. It allows you to customize the number of nodes, the success rate of block generation, and the presence of malicious nodes. You can use this simulation to study the growth rate of the blockchain and assess the impact of malicious nodes, including fork attacks and selfish mining.
To run the PoW blockchain simulation, execute the main script:
python .\main.py
The mining process and result will be output in \log
You can customize the following parameters in the main.py script:
- Number of nodes
- Number of malicious nodes
- Success rate of block generation (defined as the leading zeros of block hash value)
This simulation measures the growth rate of the blockchain based on the specified parameters.
This simulation introduces a certain number of malicious nodes and measures the length of successful fork attacks. Run the simulation for different proportions of malicious nodes (e.g., 10%-40%) to assess their impact on the network.
Evaluate the proportion of revenue gained from selfish mining under different proportions of malicious nodes.
Contributions to this project are welcome. If you have suggestions, bug reports, or would like to add new features, please open an issue or submit a pull request.
This project is licensed under the MIT License.