Platform Overview

Medicine batch traceability and digital record verification

Initializing WASM...
Academic DAA & Cryptography Project

Verifiable Medicine Batch Traceability

MedicineGuard is a medicine batch traceability and digital record verification system that uses SHA-256 hashing and Merkle Trees.

Role-Based Experiences

Manufacturer

Register and manage medicine batches. Generates canonical MG01 records, builds balanced Merkle Trees, and produces individual unit QR references.

Open Portal

Pharmacist

Inspect and verify medicine records. Evaluates MGP1 cryptographic proofs against manufacturer root commitments with complete path transparency.

Open Verification

Customer

Check a medicine's digital record against an authorized batch root. Demonstrates client-side Merkle proof verification for pharmaceutical packages.

Verify Medicine
Cryptographic Traceability Lifecycle
1
Batch Registration

Manufacturer compiles individual medicine units with unique identifiers into canonical MG01 binary structures.

2
Root Commitment

The C/WASM engine constructs a Merkle Tree, generating a single 32-byte cryptographic root committing all units.

3
Unit QR References

Each package receives an encoded QR reference with its unit serial, batch root, and compact MGP1 sibling path.

4
Instant Verification

Pharmacist or customer inspects the proof in O(log N) time without requiring a centralized record database.

Algorithmic Invariants & Security Guarantees

MedicineGuard implements strict domain separation (RFC 6962) with a 0x00 prefix on leaf nodes and 0x01 on internal parents to mathematically rule out second-preimage collision attacks. Odd nodes are promoted deterministically without duplicating data, preventing Bitcoin-style tree duplication vulnerabilities.

C11 Standard FIPS 180-4 SHA-256 RFC 6962 Domain Separation Deterministic Odd-Node Promotion Constant-Time Comparison
Local Generation Notice: This batch is generated locally. It is not yet published to a trusted shared registry. Refreshing the application may remove it.
Register Medicine Batch
C / WebAssembly Engine

Enter batch production parameters. When submitted, the WebAssembly engine serializes all individual medicine units into canonical MG01 binary structures, builds a balanced Merkle Tree with odd-node promotion, and computes the tamper-evident 32-byte Merkle Root.

Unique identifier for this production run (1–64 characters).
Commercial formulation and dosage (1–128 characters).
ISO 8601 format (YYYY-MM-DD).
Must be strictly after manufacturing date (YYYY-MM-DD).
Quick Presets:
Positive integer between 1 and 100,000 units.
Pharmacist Medicine Verification Portal
Native C/WASM Engine

Licensed pharmacists use this portal to inspect individual medicine packages (blister packs, vials, cartons) and verify their digital record membership against trusted Merkle Roots using native C11/WebAssembly cryptographic proofs.

Session Notice: Verification currently uses batches generated in this browser session. Shared verification across devices will be available after trusted backend integration. Refreshing the browser may remove locally generated batches.
Mode: Cross-device verification via Cloudflare D1
Lookup & Cryptographic Verification
MG01 Canonical Query
Unique serial ID stamped on unit blister pack or vial.
Leave blank to search across all registered session batches.
Browser Session Verification History

History is retained strictly in browser-session memory and cleared upon page reload. Entries are recorded only when an actual cryptographic verification executes through the native C WebAssembly engine.

Timestamp Unit Serial ID Batch ID Verification Result C Engine Status Action
No medicine verification attempts recorded in this browser session yet.
Shared Registry Verification Audit Trail (Cloudflare D1)

Immutable cryptographic verification logs recorded in the distributed backend database for tamper-evident compliance.

Timestamp Unit Serial ID Batch ID Pharmacist Client Result Server Result
No server audit logs recorded yet.
Customer Medicine Verification
Public & Mobile-First

Verify individual medicine packages directly against registered Merkle Tree cryptographic commitments on the shared trusted registry. No account or login required.

Camera QR Scanner

Scan the serialized verification QR code printed on your medicine carton or blister pack.

Uses device rear-facing camera. Zero remote video upload.

Manual Reference Code Entry
Fallback Option

If you do not have a camera or the QR code is damaged, enter the 32-character hexadecimal verification code printed under the QR code:

Core Cryptographic Engine & Runtime Health
Evaluating Engine...

MedicineGuard executes its core algorithms using standard C11 compiled to WebAssembly (wasm32) via the Emscripten toolchain, ensuring native cryptographic performance and bit-for-bit mathematical parity between client browsers and backend systems.

WASM Engine Status
Loading...
Initial Linear Memory
16 MB
Generational Handle Slots
32 Slots
Engine Load Time
-- ms
Live WebAssembly Cryptographic Self-Check

The diagnostic below executes a live FIPS 180-4 SHA-256 computation directly inside the loaded WebAssembly engine to verify linear memory safety and exported C function invocation:

Input String: "MedicineGuard"
Computed Hash: Executing live SHA-256...
Module Target: wasm32-unknown-emscripten (Clang 24.0.0git, -O3)
Memory Growth: Enabled (16 MB initial, 256 MB max ceiling)
Heap Tracking: Dynamic HEAPU8 (Detached ArrayBuffer Immune)
Interactive Merkle Tree Visualizer
C11/WASM Invariant Parity

Inspect the cryptographic structure of medicine batches. Click any leaf node (unit) to trace its O(log N) verification path up to the Merkle Root, highlighting sibling nodes, odd-node promotion paths, and domain separation prefixes.

View:
Drag to pan · Scroll to zoom · Click leaf to highlight proof path Batch: -- · Leaves: -- · Height: --

Select a batch to inspect its cryptographic tree

Registers and unit proof paths will appear here with bit-for-bit math breakdown.

DAA Implementation & Security Invariants
Component Implementation Standard Algorithmic Property
Hash Function FIPS 180-4 SHA-256 256-bit collision resistance, 64-round compression loop
Domain Separation RFC 6962 Standard Prefix 0x00 for leaves, 0x01 for parents; prevents second-preimage attack
Record Wire Format MG01 Binary Protocol Deterministic serialization with 32-bit big-endian field lengths
Tree Structure Binary Merkle Tree Balanced tree with deterministic odd-node promotion
Proof Wire Format MGP1 Binary Protocol 14-byte header + 33-byte step records (32B hash + 1B direction)
Proof Verification Constant-time crypto_memcmp O(log N) path traversal; immune to timing side-channel attacks
Administration & Identity Management
Administrator Access

Manage authorized system users, provisioning Manufacturer and Pharmacist accounts, toggling account statuses, and performing administrative password resets.

Provision Authorized User
Registered System Users
User Email Role Status Created At Actions
Loading users...