# abdullaha0/v2xsecurity architecture

> Architecture diagram of the GitHub repository abdullaha0/v2xsecurity, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdullaha0/v2xsecurity
- Repository: https://github.com/abdullaha0/v2xsecurity

## Overview

This repository is a Java simulation of a V2X Sybil-resistance mechanism. The workflow starts the simulation, creates legitimate and Sybil vehicle threads, has each vehicle mine a time-window-bound SHA-256 proof-of-work token, and submits tokens for freshness, replay, and per-window rate checks. The simulation then reports per-vehicle and per-window outcomes. Configuration, token data, mining, admission, and reporting are represented as distinct responsibilities. The README documents the mechanism; relationships below are limited to those shown in excerpts or explicitly documented.

Main entry points: [`sim.java`](https://github.com/abdullaha0/v2xsecurity/blob/main/sim.java) (Simulation runner), [`vehicle.java`](https://github.com/abdullaha0/v2xsecurity/blob/main/vehicle.java) (Vehicle threads), [`rateControlLayer.java`](https://github.com/abdullaha0/v2xsecurity/blob/main/rateControlLayer.java) (Rate-control checks), [`cryptoLayer.java`](https://github.com/abdullaha0/v2xsecurity/blob/main/cryptoLayer.java) (PoW mining and verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_runner["Simulation runner<br/>[sim.java]"]
  node_vehicles["Vehicle threads<br/>[vehicle.java]"]
  node_report["Summary report<br/>[sim.java]"]
end

subgraph group_pow["Proof Of Work"]
  node_miner["PoW mining and verification<br/>[cryptoLayer.java]"]
end

subgraph group_admission["Token Admission"]
  node_admitter["Rate-control checks"]
  node_windowstate[("Window and replay state")]
end

subgraph group_shared["Shared Data"]
  node_config["Simulation settings<br/>[config.java]"]
  node_token["Solved token<br/>[token.java]"]
end

node_operator(("Simulation launcher"))

node_operator -->|"launches"| node_runner
node_runner -->|"reads settings"| node_config
node_runner -->|"creates controller"| node_admitter
node_runner -->|"creates and starts"| node_vehicles
node_vehicles -->|"reads settings"| node_config
node_vehicles -->|"mines tokens"| node_miner
node_miner -->|"reads difficulty and window"| node_config
node_miner -->|"creates"| node_token
node_vehicles -->|"submits token"| node_admitter
node_admitter -->|"verifies token"| node_miner
node_admitter -->|"reads acceptance cap"| node_config
node_admitter -->|"updates counters and replay set"| node_windowstate
node_runner -->|"prints summary"| node_report
node_report -->|"reads attempt statistics"| node_vehicles
node_report -->|"reads window statistics"| node_windowstate

click node_runner "https://github.com/abdullaha0/v2xsecurity/blob/main/sim.java"
click node_vehicles "https://github.com/abdullaha0/v2xsecurity/blob/main/vehicle.java"
click node_report "https://github.com/abdullaha0/v2xsecurity/blob/main/sim.java"
click node_config "https://github.com/abdullaha0/v2xsecurity/blob/main/config.java"
click node_miner "https://github.com/abdullaha0/v2xsecurity/blob/main/cryptoLayer.java"
click node_token "https://github.com/abdullaha0/v2xsecurity/blob/main/token.java"
click node_admitter "https://github.com/abdullaha0/v2xsecurity/blob/main/rateControlLayer.java"
click node_windowstate "https://github.com/abdullaha0/v2xsecurity/blob/main/rateControlLayer.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runner,node_vehicles,node_report toneBlue
class node_miner toneAmber
class node_admitter,node_windowstate toneMint
class node_config,node_token toneRose
class node_operator toneIndigo
```

## Components

### Simulation

- [Simulation runner](https://github.com/abdullaha0/v2xsecurity/blob/main/sim.java): `sim.java`
- [Vehicle threads](https://github.com/abdullaha0/v2xsecurity/blob/main/vehicle.java): `vehicle.java`
- [Summary report](https://github.com/abdullaha0/v2xsecurity/blob/main/sim.java): `sim.java`

### Proof Of Work

- [PoW mining and verification](https://github.com/abdullaha0/v2xsecurity/blob/main/cryptoLayer.java): `cryptoLayer.java`

### Token Admission

- [Rate-control checks](https://github.com/abdullaha0/v2xsecurity/blob/main/rateControlLayer.java): `rateControlLayer.java`
- [Window and replay state](https://github.com/abdullaha0/v2xsecurity/blob/main/rateControlLayer.java): `rateControlLayer.java`

### Shared Data

- [Simulation settings](https://github.com/abdullaha0/v2xsecurity/blob/main/config.java): `config.java`
- [Solved token](https://github.com/abdullaha0/v2xsecurity/blob/main/token.java): `token.java`

### Other components

- **Simulation launcher**

## Connections

- Simulation launcher → Simulation runner: launches (evidence: `README.md`)
- Simulation runner → Simulation settings: reads settings (evidence: `sim.java`)
- Simulation runner → Rate-control checks: creates controller (evidence: `sim.java`)
- Simulation runner → Vehicle threads: creates and starts (evidence: `sim.java`)
- Vehicle threads → Simulation settings: reads settings (evidence: `vehicle.java`)
- Vehicle threads → PoW mining and verification: mines tokens (evidence: `vehicle.java`)
- PoW mining and verification → Simulation settings: reads difficulty and window (evidence: `cryptoLayer.java`)
- PoW mining and verification → Solved token: creates (evidence: `cryptoLayer.java`)
- Vehicle threads → Rate-control checks: submits token (evidence: `vehicle.java`)
- Rate-control checks → PoW mining and verification: verifies token (evidence: `rateControlLayer.java`)
- Rate-control checks → Simulation settings: reads acceptance cap (evidence: `rateControlLayer.java`)
- Rate-control checks → Window and replay state: updates counters and replay set (evidence: `rateControlLayer.java`)
- Simulation runner → Summary report: prints summary (evidence: `sim.java`)
- Summary report → Vehicle threads: reads attempt statistics (evidence: `sim.java`)
- Summary report → Window and replay state: reads window statistics (evidence: `sim.java`)
