How arielsltty/ipchain-tracker works
Project type and purpose
• This is a full-stack decentralized application (“dApp”) built on the Internet Computer Protocol (ICP).
• Backend: Smart canister written in Motoko (src/ipblock_backend/main.mo).
• Frontend: React + Tailwind CSS (src/ipblock_frontend).
• Purpose: Track user login IPs, provide audit history, anomaly detection, and map visualization, all on‐chain.
File structure
• Top level: dfx.json (ICP canister config), package.json, tsconfig.json.
• src/declarations: auto‐generated TypeScript bindings for backend and frontend canisters.
• src/ipblock_backend: Motoko smart canister.
• src/ipblock_frontend: React app with Vite config, components, public assets, styles.
Key points from README
• Uses Internet Identity (WebAuthn) for login.
• Data stored immutably on blockchain via smart canister.
• Real-time anomaly detection and geo‐location map.
Main components
a. User’s Browser (React SPA)
b. Internet Identity Service (WebAuthn auth provider)
c. ICP Network & Smart Canister (Motoko backend)
d. Persistent Blockchain Storage (ICP ledger within the canister)
e. GeoIP Service or Internal GeoIP Module
f. Anomaly Detection Logic (inside canister)
g. External Map Library (in React)
h. dfx Management Interface (optional, for deployment)
Relationships & data flow
1. User → Browser SPA: HTTP(s) serving index.html & React assets via Vite dev server or CDN.
2. Browser → Internet Identity: WebAuthn handshake for login.
3. Browser → Canister: authenticated ic.invoke calls (e.g., recordLogin(ip, deviceInfo)).
4. Canister → Internal GeoIP: resolve IP→location (or call external GeoIP API).
5. Canister stores login record + geolocation + timestamp on‐chain.
6. Canister triggers anomaly detection logic: compares new login vs historical records.
7. On fetch requests, Canister returns audit trail & anomaly flags.
8. Browser → Map Component: consumes canister data to render world map visualization.
Architectural patterns & tech
• Decentralized backend: single canister encapsulating state, business logic, storage.
• Client‐canister RPC via Internet Identity principals.
• React SPA as thin client, uses Vite and Tailwind.
• MVC‐style separation: React components (View), canister methods (Controller/Model).
• dfx.json defines canister build/deploy.