bt-ddos-shield
is a Python package designed to address the critical issue of Distributed Denial-of-Service (DDoS) attacks
in bittensor ecosystem. The project leverages encryption to protect communication between miners and validators, ensuring
the IPs and ports of these nodes remain secure and hidden from malicious actors. This decentralized solution aims to eliminate
the financial burden caused by traditional DDoS protection methods like WAF and Cloudflare, which are often costly and
impractical for subnets handling large volumes of data.
The goal of this project is to implement a distributed and decentralized system that:
- Protects miner and validator IP addresses from exposure, preventing potential DDoS attacks.
- Removes the need for on-chain storage of unencrypted IP addresses and ports, eliminating an obvious attack surface.
- Uses encrypted messages between miners and validators to securely exchange connection information (connection address).
- Provides a scalable, decentralized alternative to traditional DDoS protection methods while maintaining performance and minimizing attack vectors.
-
Encryption-Based Communication:
- Uses ECIES (Elliptic Curve Integrated Encryption Scheme) to encrypt communication between miners and validators.
- The encrypted data includes connection details for validator (IP, IP version, and port).
-
Decentralized DDoS Mitigation:
- Removes the need for centralized DDoS protection services by distributing connection information securely across nodes.
- Prevents IP address exposure by sharing encrypted connection data through a decentralized network of subtensors.
-
Secure Message Exchange:
- Validators can request the connection information of miners from the subtensor network. This information is validated and decrypted locally using the validator's private key.
pip install bt-ddos-shield
To contribute to the bt-ddos-shield
package, the steps below:
git clone https://github.com/bactensor/bt-ddos-shield.git
cd bt-ddos-shield
Run setup-dev.sh
script to install the required dependencies and set up the development environment.
First create a .env.test
file filling template file envs/.env.test.template
. Stub should be made by setup-dev.sh
script.
Then activate venv with source .venv/bin/activate and run the following command to execute the tests:
pytest
First create a .env
file filling template file envs/.env.template
. Stub should be made by setup-dev.sh
script.
Then activate venv with source .venv/bin/activate and run the following command to run the shield:
bin/run_shield.sh
To create a docker image, run the following command:
cd docker && ./build_image.sh
To run created docker image, first create a docker/.env
file filling template file envs/.env.template
.
Then run the following command:
cd docker && ./run_image.sh
If one wants to clean objects created by shield run the following command:
cd docker && ./run_image.sh clean
See the LICENSE file for more details.