Skip to content

Commit 8f29c5b

Browse files
authored
Merge pull request #79 from RedTeamSubnet/dfpr_v1
New challenge - dev_fingerprinter_v1 (Device Fingerprinting Challenge)
2 parents 3f45a8e + 21c190f commit 8f29c5b

151 files changed

Lines changed: 14319 additions & 104 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,20 @@ RT_VALIDATOR_HF_REPO=my_username/my_repo # !!! CHANGE THIS TO REAL HUGGINGFACE U
5959
# RT_MINER_LOGS_DIR="/var/log/agent.miner"
6060
# RT_MINER_DATA_DIR="/var/lib/agent.miner"
6161
# RT_MINER_WALLET_NAME=miner
62+
63+
64+
## Challenge configs -- ##
65+
DFP_CHALLENGE_API_KEY="proxy-api-key-here"
66+
DFP_CHALLENGE_TS_TAILNET="tailnet-id-here"
67+
DFP_CHALLENGE_TS_API_TOKEN="tskey-api-token-here"
68+
DFP_CHALLENGE_PUSHCUT_API_KEY="pushcut-api-key-here"
69+
DFP_CHALLENGE_PROXY_INTER_BASE_URL="http://localhost:8000"
70+
DFP_CHALLENGE_PROXY_EXTER_BASE_URL="http://external-ip:8000"
71+
72+
73+
RT_CFG_RAND_SEED="abcdefgh123456789"
74+
RT_COMPARER_RANDOM_SEED="abcdefgh123456789"
75+
RT_HB_CHALLENGE_LOG_DIR=volumes/storage/agent.miner/logs/ab_sniffer_v2
76+
RT_ABS_CHALLENGE_LOG_DIR=volumes/storage/agent.miner/logs/humanize_behaviour_v4
77+
RT_DFP_CHALLENGE_LOG_DIR=volumes/storage/agent.miner/logs/dfp_challenge
78+
RT_DFP_CHALLENGE_DEVICES_JSON_PATH=volumes/storage/agent.miner/logs/dfp_challenge/devices.json

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ ipython_config.py
126126
.LSOverride
127127

128128
# Icon must end with two \r
129-
Icon
129+
Icon
130+
130131

131132
# Thumbnails
132133
._*
@@ -670,6 +671,7 @@ volumes/**
670671

671672
redteam_core.egg-info/
672673
./.cache/
674+
.cache_*
673675

674676
data/
675677
logs/
@@ -678,4 +680,4 @@ logs/
678680
validator_env/
679681
miner_env/
680682
.rewardapp_cache/
681-
redteam_core/challenge_pool/ab_sniffer_v1/src/node_modules/
683+
redteam_core/challenge_pool/ab_sniffer_v1/src/node_modules/

docs/1.validator.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,7 @@ To set up a validator node on the RedTeam Subnet, follow these steps:
147147

148148
You will be prompted to enter your Hugging Face access token. Visit [Hugging Face Access Tokens](https://huggingface.co/settings/tokens) to generate one if you don't have it already.
149149
150-
6. Custom Setup for Specific Challenges
151-
152-
For setup instructions related to specific challenges, please refer to the [Validator Custom Setup](./4.validator_custom.md).
153-
154-
7. Start the validator node:
150+
6. Start the validator node:
155151
156152
```sh
157153
# Activate the virtual environment if not already activated
@@ -173,15 +169,3 @@ To set up a validator node on the RedTeam Subnet, follow these steps:
173169
174170
- `--logging.trace` - Enable trace logging
175171
- `--logging.debug` - Enable debug logging
176-
177-
8. (Optional but Recommended) Start the Auto-Update Script
178-
179-
```sh
180-
# Activate the virtual environment if not already activated
181-
source .venv/bin/activate
182-
183-
# Start auto-updater
184-
pm2 start python --name "validator_autoupdate" \
185-
-- -m scripts.validator_auto_update \
186-
-- --process-name "validator_snxxx"
187-
```
File renamed without changes.

docs/4.validator_custom.md

Lines changed: 0 additions & 41 deletions
This file was deleted.
937 KB
Loading
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Device Fingerprinter v1 Submission Guide (Active after September [20]th 2025 10:00 UTC)
2+
3+
![thumnail](../assets/images/challenges/dev_fingerprinter_v1/thumbnail.png)
4+
5+
## Overview
6+
7+
**Device Fingerprinter v1** tests miners' ability to develop a browser SDK that can accurately detect the driver type used by bots interacting with a webpage.
8+
9+
Miners must create a JavaScript fingerprinter that can distinguish between different devices through device fingerprinting techniques, analyzing browser properties, behavior patterns, and technical signatures.
10+
11+
---
12+
13+
## Example Code and Submission Instructions
14+
15+
Example codes for the Device Fingerprinter v1 can be found in the [`redteam_core/miner/commits/dev_fingerprinter_v1/`](https://github.com/RedTeamSubnet/RedTeam/blob/main/redteam_core/miner/commits/dev_fingerprinter_v1/) directory.
16+
17+
### Technical Requirements
18+
19+
- JavaScript (ES6+)
20+
- Ubuntu 24.04
21+
- Docker container support
22+
23+
### Core Requirements
24+
25+
1. Use our template from [`redteam_core/miner/commits/dev_fingerprinter_v1/src/fingerprinter/fingerprinter.js`](https://github.com/RedTeamSubnet/RedTeam/blob/main/redteam_core/miner/commits/dev_fingerprinter_v1/src/fingerprinter/fingerprinter.js)
26+
2. Keep the `runFingerprinting()` function signature and export unchanged
27+
3. Your fingerprinter must:
28+
- Collect device and browser fingerprint data
29+
- Generate a unique fingerprint hash
30+
- Send results to the designated endpoint
31+
- Complete without errors
32+
33+
### Key Guidelines
34+
35+
- **Detection Accuracy**: Your fingerprinter must accurately identify different devices and provide consistent hash values for the same device across multiple runs.
36+
- **Fingerprint Collection**:
37+
- Collect comprehensive browser and device properties
38+
- Analyze WebDriver signatures and automation artifacts
39+
- **Data Processing**:
40+
- Generate unique, consistent fingerprint hashes
41+
- Process collected data efficiently
42+
- **API Integration**:
43+
- Follow the provided API endpoint structure
44+
- Send properly formatted JSON payloads
45+
- Handle errors gracefully
46+
- **Technical Setup**:
47+
- Use modern JavaScript (ES6+) features
48+
- List dependencies in [`requirements.txt`](https://github.com/RedTeamSubnet/RedTeam/blob/main/redteam_core/miner/commits/dev_fingerprinter_v1/requirements.txt)
49+
- Use **amd64** architecture
50+
- **Limitations**
51+
- Your script must not exceed 2,000 lines. If it does, it will be considered invalid, and you will receive a score of zero.
52+
- Your dependencies must be older than January 1, 2025. Any package released on or after this date will not be accepted, and your script will not be processed.
53+
54+
### Plagiarism Check
55+
56+
We maintain strict originality standards:
57+
58+
- All submissions are compared against other miners' scripts
59+
- 100% similarity = zero score
60+
- Similarity above 60% will result in proportional score penalties based on the **detected similarity percentage**.
61+
- Note: Comparisons are only made against other miners submissions, not your own previous challenge entries.
62+
63+
## Submission Guide
64+
65+
Follow 1~6 steps to submit your script.
66+
67+
1. **Navigate to the Device Fingerprinter v1 Commit Directory**
68+
69+
```bash
70+
cd redteam_core/miner/commits/dev_fingerprinter_v1
71+
```
72+
73+
2. **Build the Docker Image**
74+
75+
To build the Docker image for the Device Fingerprinter v1 submission, run:
76+
77+
```bash
78+
docker build -t my_hub/dev_fingerprinter_v1-miner:0.0.1 .
79+
80+
# For MacOS (Apple Silicon) to build AMD64:
81+
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -t myhub/dev_fingerprinter_v1-miner:0.0.1 .
82+
```
83+
84+
3. **Log in to Docker**
85+
86+
Log in to your Docker Hub account using the following command:
87+
88+
```bash
89+
docker login
90+
```
91+
92+
Enter your Docker Hub credentials when prompted.
93+
94+
4. **Push the Docker Image**
95+
96+
Push the tagged image to your Docker Hub repository:
97+
98+
```bash
99+
docker push myhub/dev_fingerprinter_v1:0.0.1
100+
```
101+
102+
5. **Retrieve the SHA256 Digest**
103+
104+
After pushing the image, retrieve the digest by running:
105+
106+
```bash
107+
docker inspect --format='{{index .RepoDigests 0}}' myhub/dev_fingerprinter_v1:0.0.1
108+
```
109+
110+
6. **Update active_commit.yaml**
111+
112+
Finally, go to the `neurons/miner/active_commit.yaml` file and update it with the new image tag:
113+
114+
```yaml
115+
- dev_fingerprinter_v1---myhub/dev_fingerprinter_v1@<sha256:digest>
116+
```
117+
118+
---
119+
120+
## 📑 References
121+
122+
- Docker - <https://docs.docker.com>

redteam_core/challenge_pool/ab_sniffer_v3/comparer.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ def _compare_within_batch(self, miner_commit: MinerChallengeCommit):
112112
log.error = "miner_output is None"
113113
log.similarity_score = 0.0
114114
# Use the comparison API to compare outputs
115-
similarity_score = self._compare_outputs(
115+
compare_result = self._compare_outputs(
116116
miner_input=miner_log.miner_input, # Both used the same input
117117
miner_output=miner_log.miner_output,
118118
reference_output=other_log.miner_output,
119119
)
120+
similarity_score = compare_result.get("similarity_score", 1.0)
121+
reason = compare_result.get("reason", "Unknown")
120122

121123
# remove js code from comparison log because it is avaliable in `scoring_logs`
122124
_miner_output = miner_log.miner_output.copy()
@@ -131,6 +133,7 @@ def _compare_within_batch(self, miner_commit: MinerChallengeCommit):
131133
miner_output=_miner_output,
132134
reference_output=_reference_output,
133135
reference_hotkey=other_commit.miner_hotkey,
136+
reason=reason,
134137
)
135138
comparison_logs.append(comparison_log)
136139

@@ -164,7 +167,7 @@ def _compare_within_batch(self, miner_commit: MinerChallengeCommit):
164167

165168
def _compare_outputs(
166169
self, miner_input: dict, miner_output: dict, reference_output: dict
167-
) -> float:
170+
) -> dict:
168171
"""
169172
Send comparison request to challenge container's /compare endpoint.
170173
@@ -174,7 +177,7 @@ def _compare_outputs(
174177
reference_output: The output from the reference miner
175178
176179
Returns:
177-
float: Comparison score between 0 and 1
180+
dict: Comparison score between 0 and 1, and reason for the score
178181
"""
179182
_protocol, _ssl_verify = self._check_protocol(is_challenger=True)
180183

@@ -195,15 +198,19 @@ def _compare_outputs(
195198
response_data = response.json()
196199
data = response_data.get("data", {})
197200
similarity_score = data.get("similarity_score", 1.0)
201+
similarity_reason = data.get("reason", "Unknown")
198202

199203
# Normalize score to float between 0 and 1
200204
if isinstance(similarity_score, int):
201205
similarity_score = float(similarity_score)
202206
elif not isinstance(similarity_score, float):
203207
similarity_score = 1.0
204208

205-
return max(0.0, min(1.0, similarity_score))
209+
return {
210+
"similarity_score": max(0.0, min(1.0, similarity_score)),
211+
"reason": similarity_reason,
212+
}
206213

207214
except Exception as e:
208215
bt.logging.error(f"Error in comparison request: {str(e)}")
209-
return 0.0
216+
return {"similarity_score": 0.0, "reason": f"Error: {str(e)}"}

redteam_core/challenge_pool/ab_sniffer_v3/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ onion-config[pydantic-settings]~=5.1.1
1212
aiohttp~=3.10.2
1313
fastapi[all]~=0.110.1
1414
docker~=7.1.0
15-
./requirements/cfg_analyser_binary-1.6.0-py3-none-any.whl
15+
./requirements/cfg_analyser_binary-2.0.0-py3-none-any.whl

0 commit comments

Comments
 (0)