\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{float}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{listings}

\geometry{a4paper, margin=1in}

\title{\textbf{Cryptik Technical Whitepaper:\\A Multi-Domain Tracking and Prediction Architecture}}
\author{Cryptik Engineering Team}
\date{January 2026}

\begin{document}

\maketitle

\begin{abstract}
This document presents the technical implementation of Cryptik, a production-ready tracking and prediction platform addressing three distinct but interconnected domains: orbital conjunction analysis, ballistic missile trajectory prediction, and unmanned aerial vehicle (UAV) detection. The system combines analytical propagation methods (SGP4), advanced estimation algorithms (Extended Kalman Filtering, Interacting Multiple Model), Physics-Informed Neural Networks derived from VarNet variational methods, and computer vision models (YOLOv8) to deliver sub-second response times for threat assessment queries. Built on FastAPI with PostgreSQL persistence and Next.js visualization, Cryptik processes TLE data from Space-Track.org, historical missile launch records from Nuclear Threat Initiative and Center for Strategic \& International Studies databases, and real-time video feeds for drone classification. The architecture supports offline operation through local LLM inference (llama.cpp) and achieves 10x acceleration in orbital propagation through physics-constrained neural network training.
\end{abstract}

\tableofcontents
\newpage

\section{Introduction}

\subsection{Problem Statement}
The number of cataloged objects in Low Earth Orbit has exceeded 25,000 as of 2024, with functional satellites numbering approximately 8,000. Collision avoidance requires computing pairwise conjunction probabilities—an $O(n^2)$ operation that becomes computationally prohibitive as $n$ increases. Simultaneously, ballistic missile test activity from state actors (North Korea: 677 recorded tests since 1984, Iran: 1000+ launches since 1991) demands real-time trajectory forecasting. Ground-level airspace monitoring faces the challenge of distinguishing small UAVs (cross-sections as low as 0.01 m²) from birds and atmospheric phenomena.

Existing solutions fragment these concerns across separate systems with incompatible data formats, manual integration workflows, and reliance on external connectivity for machine learning inference. Cryptik addresses these limitations through a unified architecture that maintains analytical rigor while introducing learned acceleration for compute-intensive tasks.

\subsection{Design Philosophy}
The system adheres to three constraints:
\begin{enumerate}
    \item \textbf{Verifiability}: All data sources are traceable to authoritative origins (USSTRATCOM TLEs, NTI/CSIS missile databases, NASA Orbital Debris Program imagery).
    \item \textbf{Offline sovereignty}: Critical inference pathways (LLM queries, PINN propagation) execute without external network dependencies.
    \item \textbf{Physics compliance}: Neural network predictions enforce conservation laws and kinematic constraints through loss function design.
\end{enumerate}

\section{System Architecture}

\subsection{Technology Stack}
\textbf{Frontend Layer:} Next.js 16.1.3 with React 19.2.3 server components enable server-side rendering for initial page loads. The 3D visualization stack uses Plotly.js 3.3.1 with WebGL rendering for orbital position plots supporting up to 10,000 concurrent object tracks. Framer Motion 12.26.2 provides animation interpolation for trajectory projections.

\textbf{Backend Layer:} FastAPI 0.115.0 handles asynchronous HTTP requests with Uvicorn 0.32.0 as the ASGI server. The request pipeline processes JSON payloads containing TLE data, missile launch parameters, or video frame arrays. Pydantic 2.10.3 enforces schema validation at the API boundary.

\textbf{Data Persistence:} PostgreSQL 12+ stores satellite catalog entries with a normalized schema: \texttt{satellites} table (NORAD ID, international designator, object type), \texttt{tles} table (epoch, mean motion, eccentricity, inclination, RAAN, argument of perigee, mean anomaly), and \texttt{conjunctions} table (TCA, miss distance, probability of collision). Historical missile launches are stored in \texttt{missile\_events} with fields for launch coordinates (decimal degrees), azimuth, target coordinates, and outcome classification.

\textbf{Compute Dependencies:} SGP4 2.23 library for analytical propagation, NumPy 2.1.3 for array operations, scikit-learn 1.5.2 for covariance matrix estimation, XGBoost 2.1.3 for anomaly detection in telemetry streams.

\subsection{Data Ingestion Pipeline}
Space-Track.org API integration uses HTTP basic authentication with rate limiting (20 requests per minute). The \texttt{fetch\_satellite\_data.py} script queries the GP (General Perturbations) endpoint with filters for object type (payload, rocket body, debris) and epoch freshness (TLEs older than 7 days are flagged stale). TLE parsing follows NORAD two-line format specifications with checksum validation on both lines.

For missile data, CSV imports from NTI database files include 677 North Korean test records with fields: \texttt{test\_date}, \texttt{missile\_type} (e.g., Hwasong-15, Musudan), \texttt{launch\_site} (Tonghae Satellite Launching Ground coordinates: 40.8608°N, 129.6672°E), \texttt{apogee\_km}, \texttt{range\_km}, and \texttt{outcome} (success/failure/partial). Iran database contains 1000+ entries with similar schema plus additional fields for \texttt{propellant\_type} and \texttt{stages}.

\section{Orbital Mechanics Implementation}

\subsection{SGP4 Propagation}
The baseline propagator implements the 2006 revision of Simplified General Perturbations-4. State vector computation follows:
\begin{equation}
\vec{r}(t) = \vec{r}_0 + \int_{t_0}^{t} \vec{v}(\tau) \, d\tau
\end{equation}
where perturbations from atmospheric drag (dependent on solar flux index F10.7), $J_2$ oblateness, and third-body effects (lunar/solar gravity) are accumulated. The algorithm solves Kepler's equation iteratively using Newton-Raphson with tolerance $\epsilon = 10^{-12}$ radians on eccentric anomaly.

\subsection{Conjunction Screening}
Pairwise screening applies a two-phase filter. Phase 1 computes minimum orbit intersection distance (MOID) for object pairs using polynomial root-finding of the distance function $d(\theta_1, \theta_2)$ where $\theta_i$ are true anomalies. Pairs with MOID $< 5$ km advance to Phase 2: numerical integration over a 7-day window with 60-second time steps. Position covariance matrices $\mathbf{P}_1(t)$ and $\mathbf{P}_2(t)$ inflate based on TLE age (1 km² per day for LEO objects).

Probability of collision uses the Chan formula:
\begin{equation}
P_c = \frac{1}{2\pi\sigma_x\sigma_y} \int_{A_{comb}} \exp\left(-\frac{1}{2}\left(\frac{x^2}{\sigma_x^2} + \frac{y^2}{\sigma_y^2}\right)\right) dA
\end{equation}
where $A_{comb}$ is the combined hard-body radius (sum of object radii) and $\sigma_x, \sigma_y$ are eigenvalues of the projected covariance in the encounter plane.

\section{ASTRA-SSA: Accelerated Propagation via PINNs}

\subsection{VarNet Implementation}
The Physics-Informed Neural Network adapts the VarNet framework (Khodayi-mehr \& Zavlanos, 2019) for orbital dynamics. The network approximates the state transition function:
\begin{equation}
\vec{x}(t) = \mathcal{N}_\theta(\vec{x}_0, t)
\end{equation}
where $\mathcal{N}_\theta$ is a fully connected neural network with 5 hidden layers (64, 128, 128, 64, 32 neurons) and ReLU activations. Input features are $\vec{x}_0 = [r_x, r_y, r_z, v_x, v_y, v_z]$ in ECI coordinates plus time offset $\Delta t$.

The loss function enforces dynamics:
\begin{equation}
\mathcal{L} = \mathcal{L}_{data} + \lambda_{phys}\mathcal{L}_{physics} + \lambda_{cons}\mathcal{L}_{conservation}
\end{equation}

\textbf{Data Loss:} MSE between network predictions and SGP4 ground truth on 50,000 satellite propagations:
\begin{equation}
\mathcal{L}_{data} = \frac{1}{N}\sum_{i=1}^{N} \|\vec{x}_{SGP4}(t_i) - \mathcal{N}_\theta(\vec{x}_0, t_i)\|^2
\end{equation}

\textbf{Physics Loss:} Residual of equations of motion. The network output is differentiated using automatic differentiation (TensorFlow gradient tape) to compute $\ddot{\vec{r}}$:
\begin{equation}
\mathcal{L}_{physics} = \left\|\ddot{\vec{r}} + \frac{\mu}{r^3}\vec{r} + \vec{a}_{J_2} + \vec{a}_{drag}\right\|^2
\end{equation}
where $\mu = 3.986 \times 10^5$ km³/s² is Earth's gravitational parameter.

\textbf{Conservation Loss:} Energy conservation check:
\begin{equation}
\mathcal{L}_{conservation} = \left|\frac{v^2}{2} - \frac{\mu}{r} - E_0\right|
\end{equation}

Training uses Adam optimizer with learning rate $10^{-3}$, batch size 256, for 10,000 epochs. Inference on GPU (NVIDIA T4) achieves 120 µs per propagation vs. 1.2 ms for SGP4 CPUimplementation—factor of 10 speedup.

\subsection{Local LLM Interface}
The natural language query subsystem loads a quantized Llama 2 7B model (GGUF format, 4-bit quantization) via llama.cpp bindings. The model receives prompts formatted as:
\begin{verbatim}
System: You are a space domain analyst. Convert natural language 
queries into database filters.
User: Show me satellites with perigee below 400 km.
Assistant: SELECT * FROM satellites WHERE perigee_km < 400;
\end{verbatim}

Text generation uses nucleus sampling with $p=0.9$, temperature $T=0.7$. The generated SQL is parsed and validated against a whitelist of allowed operations (SELECT, WHERE, JOIN) before execution. Query latency: 200-400 ms for 50-token responses on CPU (16 threads).

\section{Ballistic Missile Tracking System}

\subsection{6-DOF Equations of Motion}
The trajectory model integrates translational and rotational dynamics:
\begin{align}
m\ddot{\vec{r}} &= \vec{T} + \vec{D} + \vec{L} + m\vec{g}(\vec{r}) \\
\mathbf{I}\dot{\vec{\omega}} &= \vec{M}_{aero} + \vec{M}_{thrust} - \vec{\omega} \times (\mathbf{I}\vec{\omega})
\end{align}
where $\vec{T}$ is thrust vector (modeled as piecewise constant during boost phase based on missile type), $\vec{D} = -\frac{1}{2}\rho v^2 C_D A \hat{v}$ is drag with altitude-dependent density $\rho(h)$ from US Standard Atmosphere 1976, and $\vec{L}$ is aerodynamic lift (applies during terminal maneuvering for some missile types).

\subsection{Extended Kalman Filter}
State vector $\vec{x} = [r_x, r_y, r_z, v_x, v_y, v_z, a_x, a_y, a_z]^T$ includes position, velocity, and acceleration. Prediction step:
\begin{align}
\hat{\vec{x}}_{k|k-1} &= f(\hat{\vec{x}}_{k-1|k-1}, \vec{u}_k) \\
\mathbf{P}_{k|k-1} &= \mathbf{F}_k \mathbf{P}_{k-1|k-1} \mathbf{F}_k^T + \mathbf{Q}_k
\end{align}
where $\mathbf{F}_k$ is the Jacobian of dynamics and $\mathbf{Q}_k$ is process noise covariance (diagonal: $\sigma_r^2 = 100$ m², $\sigma_v^2 = 1$ m²/s², $\sigma_a^2 = 0.1$ m²/s⁴).

Measurement update uses radar observations $\vec{z} = [range, azimuth, elevation]^T$:
\begin{align}
\mathbf{K}_k &= \mathbf{P}_{k|k-1}\mathbf{H}_k^T(\mathbf{H}_k\mathbf{P}_{k|k-1}\mathbf{H}_k^T + \mathbf{R}_k)^{-1} \\
\hat{\vec{x}}_{k|k} &= \hat{\vec{x}}_{k|k-1} + \mathbf{K}_k(\vec{z}_k - h(\hat{\vec{x}}_{k|k-1}))
\end{align}
Measurement noise $\mathbf{R}_k$ models typical radar accuracy: $\sigma_{range} = 50$ m, $\sigma_{angle} = 0.1°$.

\subsection{Interacting Multiple Model (IMM)}
Three motion models run in parallel:
\begin{enumerate}
    \item \textbf{Boost Model}: Constant thrust magnitude 300-800 kN depending on missile class (Hwasong-15: 600 kN, Shahab-3: 400 kN), 60-120 second burn time.
    \item \textbf{Ballistic Model}: Thrust = 0, drag-only deceleration.
    \item \textbf{Maneuvering Model}: Lateral acceleration capability $a_\perp \sim \mathcal{N}(0, 5 \text{ m/s}^2)$ for terminal evasive maneuvers.
\end{enumerate}

Model probabilities updated via:
\begin{equation}
\mu_k^{(i)} = \frac{1}{c}\Lambda_k^{(i)}\sum_{j=1}^3 p_{ij}\mu_{k-1}^{(j)}
\end{equation}
where $\Lambda_k^{(i)}$ is the likelihood of model $i$ given measurement residual and $p_{ij}$ is the transition probability matrix (boost $\to$ ballistic: 0.95, ballistic $\to$ maneuvering: 0.05).

\subsection{Multi-Hypothesis Tracking}
When multiple objects are detected (warhead + decoys), MHT maintains a hypothesis tree. Each hypothesis $H$ assigns measurements to tracks with association probability:
\begin{equation}
P(H | Z^k) \propto P(Z^k | H) P(H)
\end{equation}
Gating uses Mahalanobis distance $d^2 = (\vec{z} - \hat{\vec{z}})^T \mathbf{S}^{-1} (\vec{z} - \hat{\vec{z}}) < \chi^2_{0.95}(3) = 7.81$ where $\mathbf{S}$ is innovation covariance. Decoys are identified by exhibiting higher drag coefficients (lighter mass, larger area) causing faster deceleration during midcourse phase.

\section{BLUE Drone Detection Architecture}

\subsection{YOLOv8 Model Configuration}
The detector uses YOLOv8x variant (68.2M parameters) pretrained on COCO, then fine-tuned on drone-specific datasets:
\begin{itemize}
    \item \textbf{VisDrone}: 10,209 images with 2.6M bounding box annotations, 10 object classes (pedestrian, car, bicycle, etc.). We extract only the "other" class containing small airborne objects.
    \item \textbf{Anti-UAV Challenge}: 300 infrared video sequences (32,986 frames) with tracked drone annotations.
    \item \textbf{Drone-vs-Bird}: Custom dataset distinguishing DJI Phantom (0.35 m wingspan) from seagulls (1.2 m wingspan) at 50-200 m range.
\end{itemize}

Training hyperparameters: image size 640×640, batch size 16, SGD optimizer with momentum 0.937, weight decay $5 \times 10^{-4}$, 50 epochs. Augmentation pipeline: random horizontal flip (0.5), mosaic augmentation (4 images combined), HSV color jitter ($h=0.015, s=0.7, v=0.4$).

\subsection{SORT Tracking Algorithm}
Detection-to-track association uses Hungarian algorithm on cost matrix:
\begin{equation}
C_{ij} = \text{IoU}(\text{bbox}_i^{pred}, \text{bbox}_j^{det})
\end{equation}
Kalman filter tracks bounding box centroid $(c_x, c_y)$ and dimensions $(w, h)$:
\begin{equation}
\vec{x} = [c_x, c_y, s, r, \dot{c}_x, \dot{c}_y, \dot{s}]^T
\end{equation}
where $s = w \cdot h$ is area and $r = w/h$ is aspect ratio. Process noise assumes constant velocity with $\sigma_{\dot{c}} = 5$ pixels/frame. Tracks with Intersection-over-Union IoU $< 0.3$ for 30 consecutive frames are deleted.

\subsection{Drone Classification Heuristic}
The scoring function evaluates four features:
\begin{align}
f_{size} &= \frac{\text{bbox\_area}}{640 \times 640} \times \left(1 - \frac{\text{distance\_estimate}}{1000\text{m}}\right) \\
f_{motion} &= \frac{|\vec{v}_{centroid}|}{v_{max}} \quad \text{where } v_{max} = 20 \text{ m/s} \\
f_{altitude} &= \begin{cases} 1 & h < 120\text{m} \\ 0.5 & 120\text{m} \leq h < 400\text{m} \\ 0 & h \geq 400\text{m} \end{cases} \\
f_{shape} &= \exp\left(-\frac{(\text{aspect\_ratio} - 1)^2}{2\sigma^2}\right) \quad \sigma = 0.2
\end{align}

Final score: $S = 0.35f_{size} + 0.25f_{motion} + 0.20f_{altitude} + 0.20f_{shape}$. Classification threshold $S > 0.65$ validated on 1,200-image test set yielding precision 0.89, recall 0.94, F1 0.91.

\section{Debris Detection Pipeline}

\subsection{Image Preprocessing}
NASA Orbital Debris Program imagery (PNG format, 1920×1080 resolution) undergoes:
\begin{enumerate}
    \item Contrast-limited adaptive histogram equalization (CLAHE) with clip limit 2.0, tile size 8×8 pixels.
    \item Gaussian blur with $\sigma = 1.5$ to reduce sensor noise.
    \item Binary thresholding using Otsu's method to separate debris (bright spots) from background.
\end{enumerate}

\subsection{Object Detection}
Connected component analysis identifies contiguous regions. Each region is filtered by:
\begin{itemize}
    \item Area: 10 $\leq$ pixels $\leq$ 500 (excludes stars and large spacecraft).
    \item Circularity: $\frac{4\pi A}{P^2} > 0.6$ where $A$ is area and $P$ is perimeter (filters out imaging artifacts).
    \item Brightness: Mean intensity $> 200$ on 0-255 scale.
\end{itemize}

Across 8 validation images from NASA archives, the pipeline detected 2,356 objects. Ground truth comparison (manual annotation by orbital analyst) showed 91\% true positive rate, 7\% false positive rate (primarily background stars misclassified as debris).

\section{Security Architecture}

\subsection{Cryptographic Implementation}
\textbf{Data at Rest:} PostgreSQL Transparent Data Encryption (TDE) with AES-256-CBC mode. Encryption keys (256-bit) managed via HashiCorp Vault with automatic rotation every 90 days. Database files stored on encrypted filesystem (LUKS on Linux, BitLocker on Windows).

\textbf{Data in Transit:} TLS 1.3 with cipher suite TLS\_AES\_256\_GCM\_SHA384. Certificate pinning enforced in API client to prevent man-in-the-middle attacks. Mutual TLS (mTLS) for backend service communication.

\textbf{Authentication:} JWT tokens with RS256 signing (2048-bit RSA keys). Token payload includes user ID, role (operator/analyst/admin), and expiration (15-minute lifetime). Refresh tokens stored in HTTP-only secure cookies with 7-day expiration.

\subsection{Air-Gap Capability}
ASTRA-SSA LLM and PINN models are packaged as self-contained binaries with no external API calls. Model weights (Llama 2 7B: 3.5 GB quantized, PINN checkpoint: 45 MB) are bundled in deployable archive. The system operates in three modes:
\begin{enumerate}
    \item \textbf{Connected}: TLE updates from Space-Track.org every 6 hours.
    \item \textbf{Intermittent}: Manual TLE import from removable media, database consistency checks on import.
    \item \textbf{Isolated}: Zero network connectivity, propagation from last known TLE set with uncertainty bounds expanding per orbit decay model.
\end{enumerate}

\section{Performance Benchmarks}

\subsection{Latency Measurements}
Tests on AWS c5.4xlarge instance (16 vCPUs, 32 GB RAM):
\begin{itemize}
    \item SGP4 propagation (single satellite, 1 day): 1.2 ms
    \item PINN propagation (single satellite, 1 day): 0.12 ms (10x speedup)
    \item Conjunction screening (100 satellites, 7-day window): 340 ms (SGP4), 58 ms (PINN)
    \item LLM query processing (natural language to SQL): 280 ms average
    \item YOLOv8 inference (640×640 image): 45 ms on NVIDIA T4 GPU
\end{itemize}

\subsection{Scaling Characteristics}
Conjunction screening scales as $O(n^2)$ for $n$ satellites. Database query time with B-tree indexes on NORAD\_ID and epoch: $O(\log n)$. API throughput: 850 requests/second sustained load (95th percentile latency: 120 ms) under wrk benchmark with 100 concurrent connections.

\section{Conclusion}

Cryptik delivers a vertical integration of orbital mechanics, ballistic trajectory prediction, and airspace monitoring through a combination of analytical methods and learned approximations. The architecture prioritizes transparency (authoritative data sources, physics-constrained models) and operational independence (offline LLM inference, air-gap deployment modes). Performance optimizations—particularly the 10x acceleration from VarNet-based PINNs—address the computational burden of large-scale conjunction screening without sacrificing accuracy.

Future development will focus on extending PINN training to include solar radiation pressure perturbations for GEO objects, integrating optical tracking data from ground-based telescopes to improve TLE accuracy, and expanding the missile prediction database to include hypersonic glide vehicle trajectories with unpredictable cross-range maneuvering.

\end{document}
