Skip to content

Repository files navigation

TRUSTGRID — Universal Institutional Trust Infrastructure

Smart India Hackathon 2026 — Problem Statement 26194 (Student Innovation: Blockchain & Cybersecurity)

"Don't trust the database. Verify the proof."


1. Executive Summary & Canonical Positioning

TRUSTGRID is a sector-agnostic institutional trust infrastructure built around the Trust Object Protocol (TOP). TOP provides a common model for creating, signing, anchoring, verifying, revoking, and auditing digital and physical trust objects.

Instead of putting sensitive information on-chain, TRUSTGRID keeps sensitive data off-chain and anchors cryptographic proofs, provenance, status, and audit references to a tamper-evident blockchain ledger.

The same verification infrastructure is demonstrated across four sectors: academic credentials, pharmaceutical provenance, digital forensic evidence, and critical device integrity.

One trust protocol. Four sectors. One verification engine.

Today, every major economic sector operates an isolated, fragile island of trust:

  • Universities maintain opaque academic degree databases susceptible to SQL injection and insider forgery.
  • Pharmaceutical and manufacturing supply chains struggle with adulterated batches and counterfeit products injected during distributor transit.
  • Law enforcement and judiciaries face digital evidence spoliation challenges where CCTV files or digital records cannot provably demonstrate an unbroken chain of custody.
  • Cybersecurity teams struggle to establish tamper-evident cryptographic baselines for critical infrastructure devices and SCADA endpoints.

TRUSTGRID solves this structural vulnerability not by creating four unrelated applications, but by inventing a unified, sector-agnostic protocol: the Trust Object Protocol (TOP).


1.1 Prior Art & Protocol Differentiation

Honest Protocol Attribution & Landscape Comparison

TRUSTGRID does not claim to invent blockchain-based digital credentials, public key infrastructure (PKI), or hash-linked ledgers. Foundational research, open standards, and sector-specific tools exist across individual verticals:

Sector Existing Prior Art / Standards Scope & Architectural Focus What They Lack vs. TRUSTGRID TOP
🎓 Education Blockcerts (MIT), OpenCerts (GovTech Singapore) Single-institution academic diplomas, Ethereum / W3C VC JSON-LD schemas. Confined to academic transcripts. Lacks generic multi-hop provenance graphs, on-chain revocation accumulators, cross-sector composability, and active risk scoring.
📦 Supply Chain TradeTrust (IMDA Singapore), IBM Food Trust Electronic Bills of Lading (eBL), EPCIS shipping events, Hyperledger Fabric/Ethereum. Trade-document or cold-chain specific data structures. Incompatible with identity passports or device integrity baselines.
⚖️ Legal Evidence OpenAttestation, Guardian Evidence PDF/document attestation, notarized digital file timestamping. Point-in-time timestamping without verifiable custodian handover graphs or dynamic spoliation alert engines.
🛡️ Cybersecurity Sigstore (Linux Foundation), in-toto, SLSA Software supply chain artifact signing, Rekor transparency log. Focused on developer binary artifacts (containers, Git commits). Not designed for institutional assets, physical custody, or non-technical verifiable credentials.

The Core Architectural Problem: Fragmented Trust Silos

Existing standards are vertical-specific silos: an organization managing university degrees, physical pharmaceuticals, legal evidence, and SCADA infrastructure firmware must currently deploy, operate, and audit four completely separate cryptographic stacks, schemas, and verification clients.

The Innovation: The Trust Object Protocol (TOP)

TRUSTGRID introduces the Trust Object Protocol (TOP) as a universal, sector-agnostic institutional abstraction layer:

  1. Universal Trust Object (TO) Envelope: A single canonical JSON schema (RFC 8785) wrapping identity, payload content hash, dual Ed25519 signatures, Merkle leaf proof, and multi-node consensus endorsements.
  2. First-Class Provenance Graph: Every Trust Object embeds an immutable, cryptographic chain of custody DAG where each state transition must be counter-signed by the transferring custodian and verified on-chain.
  3. Cross-Sector Trust Passport: Subjects aggregate credentials across domains into a single portable passport featuring salted attribute commitments for privacy-preserving selective disclosure.
  4. Deterministic Heuristic Risk Engine: Real-time explainable risk assessment evaluating verification velocity, credential cloning, Sybil DID patterns, and baseline divergence—without black-box ML.
  5. Decoupled Consensus Substrate: TOP operates identically over a local multi-node consortium prototype (for zero-friction evaluation) and enterprise production backends like Hyperledger Fabric.
                       TRUSTGRID
                           │
                 TRUST OBJECT PROTOCOL (TOP)
                           │
            ┌──────────────┼──────────────┐
            │              │              │
        IDENTITY       CRYPTOGRAPHY    POLICY
            │              │              │
            └──────────────┼──────────────┘
                           │
        BLOCKCHAIN TRUST LEDGER (Consortium / Fabric)
                           │
                  ┌────────┴────────┐
                  │                 │
            VERIFICATION        PROVENANCE
               ENGINE              ENGINE
                  │                 │
                  └────────┬────────┘
                           │
               EXPLAINABLE RISK ENGINE
                           │
                    TRUST GRAPH
                           │
                   TRUST PASSPORT
                           │
            ┌──────────────┼──────────────┐
            │              │              │
        EDUCATION     SUPPLY CHAIN      LEGAL
                                          │
                                    CYBERSECURITY

2. Core Protocol Innovation: The Trust Object Protocol (TOP)

  • TOP is the central innovation.
  • Blockchain provides the tamper-evident trust substrate.
  • The four flagship sectors are real-world validations of the exact same protocol.

Every digital or physical asset registered in TRUSTGRID becomes a tamper-evident, cryptographically verifiable Trust Object:

{
  "trustObjectId": "TO-EDU-DEGREE-GENUINE-2024",
  "objectType": "CREDENTIAL",
  "subjectId": "did:trustgrid:usr:rahul-sharma",
  "issuerId": "did:trustgrid:edu:delhi-tech-univ",
  "ownerId": "did:trustgrid:usr:rahul-sharma",
  "createdAt": "2026-09-07T15:55:00.000Z",
  "expiresAt": null,
  "contentHash": "e064c5dac4f5219169ae0d09b1b91f8d9094f6a76035f97cc73422061b696176",
  "signature": "3Kz...[Ed25519 digital signature]",
  "blockchainTxId": "0xaa36adcb54ad8e9b10522e171f689c55b8921b8b795c169797b475ef47aacc79",
  "status": "ACTIVE",
  "metadata": {
    "studentName": "Rahul Sharma",
    "degreeName": "Bachelor of Technology in Computer Science & Engineering",
    "cgpa": "9.42 / 10.00",
    "serialNumber": "DTU-2024-BTECH-0942"
  },
  "provenance": [
    {
      "eventId": "EV-001",
      "eventType": "CREATION",
      "fromDid": "did:trustgrid:edu:delhi-tech-univ",
      "toDid": "did:trustgrid:usr:rahul-sharma",
      "timestamp": "2026-09-07T15:55:00.000Z",
      "signature": "...",
      "blockchainTxId": "0xaa36..."
    }
  ],
  "version": 1
}

3. The 7-Step Unified Verification Pipeline

When any Trust Object is presented to TRUSTGRID, the exact same verification engine executes:

  1. Decentralized Identity (DID) Resolution: Resolves issuer DID document and fetches the active Ed25519 public key.
  2. Canonical Hash Recalculation: Recursively computes the deterministic SHA-256 hash of the presented payload using alphabetical key sorting.
  3. Cryptographic Signature Verification: Verifies that the issuer's private key signed the original content hash.
  4. Blockchain Proof Anchor Verification: Audits the ledger for the object's Merkle leaf, block height, and validator notary signature.
  5. Anti-Tampering Hash Comparison: Compares the recalculated hash with the on-chain registered hash. Any modification flags TAMPERED.
  6. Revocation & Expiration Status: Checks if a revocation receipt exists on the blockchain ledger or if the validity window has elapsed.
  7. Provenance Continuity Check: Verifies the cryptographic chain of custody transitions to prevent unauthorized handoffs or counterfeit injection.

4. Architectural Truth & Blockchain Substrate Realism

  • 3-Node Local Consortium Prototype (Current Working State): TRUSTGRID features an inspectable, working 3-node local consortium prototype:

    • Node Alpha (node-1): Proposer / Leader on port 4101
    • Node Beta (node-2): Validator on port 4102
    • Node Gamma (node-3): Validator on port 4103
    • 2-of-3 Quorum: Deterministic majority consensus requiring at least 2 valid endorsements before any block is committed ($Q \ge 2$)
    • Independent Node Processes & Ledgers: Each node runs as an independent process maintaining its own isolated SQLite ledger file and its own Ed25519 identity keypair
    • Block Validation & Tamper Rejection: Peer nodes validate candidate block headers, height sequences, and Merkle roots, rejecting any tampered or out-of-sequence proposals
    • Offline-Node Tolerance: The cluster maintains operational continuity even when 1 node goes offline
    • Synchronization / Catch-Up: Recovering nodes automatically synchronize missing blocks from healthy peers
    • Launch nodes individually via npm run node:1, npm run node:2, npm run node:3, or run the end-to-end consensus demo via npm run demo:consortium.
  • Production Deployment Path & Adapter (Hyperledger Fabric): The blockchain substrate is cleanly decoupled through the BlockchainAdapter interface. In production enterprise deployments, the application connects to an enterprise Hyperledger Fabric network using Raft crash fault-tolerant ordering and channel-isolated ledgers. The smart contract logic is pre-implemented in Go chaincode (src/core/blockchain/fabric-chaincode/trustgrid_cc.go) and validated with 10 unit tests.

  • Consensus Integrity vs. Public Blockchain Overhead: TRUSTGRID is designed for institutional consortia (e.g., Higher Education Consortium, National Pharma Logistics, Inter-Court Judicial Network, National CERT). It deliberately avoids energy-wasting Proof-of-Work or token volatility, employing permissioned deterministic majority endorsement with Ed25519 threshold certificates.

  • Explicit Non-Claims & Engineering Realism:

    • No Production Hyperledger Deployment: The current demonstration runs on the working 3-node local consortium prototype; Hyperledger Fabric is the production deployment adapter/roadmap.
    • No Fully Decentralized Key Custody: Keypairs for institutions and nodes are managed locally via AES-256-GCM encrypted keystores; enterprise HSM integration is a future production enhancement.
    • No Full Decentralized W3C DID Network: DIDs are resolved locally within the consortium using deterministic Ed25519 key registries rather than a global public DID ledger.
    • No zk-SNARKs: Privacy-preserving selective disclosure currently utilizes cryptographic salted commitments and SHA-256 attribute blinding; zero-knowledge proofs (Groth16/Circom) are on the future roadmap.
    • No Multi-Organization Production Deployment: The current cluster is a multi-node local consortium prototype running across isolated processes on different ports.

5. Why Not Store Sensitive Data On-Chain?

Public and consortium blockchains are tamper-evident append-only ledgers. Storing student transcripts, medical specifications, or forensic files directly on-chain violates privacy frameworks (GDPR, India DPDP Act 2023) and creates blockchain bloat:

  • Sensitive metadata remains 100% off-chain in encrypted relational stores.
  • Only the cryptographic content hash, issuer DID, block timestamp, and status are anchored on-chain.
  • Privacy-Aware Trust Passport: Supports selective disclosure architecture where users can cryptographically prove their degree or credential without disclosing GPA, residential coordinates, or financial data.

6. The Four Flagship Demonstrations

Sector Demonstrated Use Case What Happens Under Attack Status Detected
🎓 Education Academic Credential Verification Student name changed from "Rahul" to "Rohan", CGPA falsified from 7.1 to 9.9 TAMPERED (Content Hash Mismatch)
📦 Supply Chain Pharmaceutical Product Provenance Unverified distributor injects counterfeit batch without manufacturer handoff signature PROVENANCE_MISMATCH (Broken Custody)
⚖️ Legal Evidence Digital Forensic Evidence Integrity Video frames edited between 02:14:00 - 02:17:30 TAMPERED (Spoliation Detected)
🛡️ Cybersecurity Critical Device Integrity Monitoring Unauthorized firewall backdoor injected into router firmware DEVICE_INTEGRITY_COMPROMISED (Critical Baseline Breach)

7. Explainable Trust Risk Engine (No AI Gimmicks)

Rather than using an opaque LLM chatbot, TRUSTGRID implements an explainable, deterministic 0–100 behavioral anomaly scoring engine that explains the factors contributing to elevated trust risk:

  • Duplicate Credential Claim (+30 risk): Same content hash claimed across multiple distinct entity DIDs.
  • High Frequency Verification Spike (+20 risk): >6 verification attempts within 15 minutes.
  • Content Hash Bit-Flip (+55 risk): Data divergence between off-chain records and on-chain proofs.
  • Broken Provenance Gap (+35 risk): Custody transfer not signed by legitimate prior owner.

Outputs human-understandable audit rationales:

Risk: 92/100 — CRITICAL
Reasons:
• Off-chain data content hash does not match on-chain proof (Tampering detected)
• Provenance transition gap: custody transfer was not signed by legitimate prior owner

8. Technology Stack

  • Backend: Node.js 24 LTS, TypeScript, Express, native node:crypto (Ed25519 & SHA-256)
  • Database: Dual-mode architecture:
    • Zero-dependency native SQLite (node:sqlite) for instant, friction-free local execution
    • Full PostgreSQL DDL migrations (schema.sql) and docker-compose.yml for enterprise deployment
  • Frontend: React 19, TypeScript, Vite, Vanilla Cyber-Aesthetic CSS (Zero Tailwind dependency for maximum control), Lucide Icons
  • Testing: Node.js native test runner (node:test, tsx)

9. Quick Start & Setup Instructions

Prerequisites

  • Node.js v20+ (Node v24 recommended)
  • npm v10+

Option A: Instant Local Startup (Recommended)

# 1. Clone or navigate to the repository
cd TRUSTGRID

# 2. Install dependencies (root & client)
npm install
npm --prefix client install

# 3. Seed database with 4 Flagship Scenarios
npm run seed

# 4. Run automated test suite (132 automated test assertions • 0 failed)
npm test

# 5. Launch unified server
npm run build
npm start

The application will start on http://localhost:5000 (serving both the REST API and the React Web UI).

Option B: Development Mode with Live Reload

# Runs Express server and Vite client concurrently
npm run dev
  • Backend API: http://localhost:5000
  • Frontend Dev Server: http://localhost:3000

Option C: Docker Deployment

docker compose up --build

Option D: Local 3-Node Consortium Consensus Demo, Network Status & Benchmark

# 1. Run the interactive 3-node consortium consensus and fault tolerance demo
npm run demo:consortium

# 2. (Optional) Run the 3 independent node daemons in separate terminal windows:
npm run node:1   # Node Alpha on port 4101 (Proposer)
npm run node:2   # Node Beta on port 4102 (Validator)
npm run node:3   # Node Gamma on port 4103 (Validator)

# 3. View the live Network Status dashboard:
# Navigate to http://localhost:5000/network or query GET /api/network/status

# 4. Run the 100-iteration cryptographic verification latency benchmark
npm run benchmark

10. Automated Test Validation & Verification Suite

================================================================================
TEST VALIDATION: 132 tests • 0 failed | 132 passing | 0 failing | 9 test categories (17 files)
Execution Time: ~5.7s (via npm test / tsx --test --test-concurrency=1 src/tests/*.test.ts)
================================================================================

TRUSTGRID features a comprehensive automated test suite of 132 automated test assertions • 0 failed (132 passing, 0 failing across 9 test categories / 17 test files) covering all protocol invariants, 3-node consortium consensus, live network status and quorum monitoring, tamper detection, sector modules, and cryptographic defenses. Every test executes against authentic cryptographic implementations without mocking the core cryptography or SQLite database engine.

npm test

Verified Cryptographic Verification Latency Benchmark

Measured on full end-to-end cryptographic Trust Object verification pipeline (Ed25519 signature audit + canonical SHA-256 recalculation + Merkle tree proof + explainable risk scoring):

Benchmark Metric Verified Result
Iterations 100
Total Test Time 76.50 ms
Throughput 1307.3 ops/sec
Mean Latency 0.765 ms
Median Latency (p50) 0.658 ms
Min Latency 0.475 ms
Max Latency 3.787 ms
95th Percentile (p95) 1.286 ms
99th Percentile (p99) 3.787 ms

Run locally via:

npm run benchmark

Categorized Test Inventory

# Category Test Count Key Invariants Verified
1 Multi-Node Consensus & Cluster Fault Tolerance 37 tests 3-node independent process HTTP consensus, gossip candidate proposals, 2/3 majority consensus ($Q \ge 2$), Byzantine rejection of invalid/tampered proposals, node crash recovery, network partition tolerance, and peer synchronization catchup.
2 Blockchain Integrity & Tamper Detection 23 tests Sequential SHA-256 block linking (previousHash), binary Merkle tree recomputation, cross-node divergence detection, and cryptographic spoliation alerts.
3 Sector Flagship Protocol Validation 12 tests Full lifecycle verification across all 4 sectors: Academic degrees (Education), Pharma cold-chain batches (Supply Chain), Digital forensic exhibits (Legal), and SCADA device firmware baselines (Cybersecurity).
4 Privacy & Cryptographic Selective Disclosure 12 tests Salted cryptographic commitments, attribute blinding, selective disclosure numeric predicate proofs (e.g. CGPA $\ge 7.5$), and dynamic identity reputation scoring.
5 Production Hyperledger Fabric Smart Contract 10 tests Enterprise Go chaincode (trustgrid_cc.go) methods, World State read/writes, endorsement policies, and ledger integrity verification.
6 Decentralized Identity & Encrypted Keystores 10 tests Ed25519 signing/verification, RFC 8785 canonical serialization, AES-256-GCM encrypted keystore management, and persistent keypair survival across simulated server restarts.
7 Risk Engine & Anomaly Detection 11 tests Explainable Trust Risk Engine factor scoring (0–100), verification velocity spikes, Sybil cross-DID credential duplication, and SCADA firmware drift detection.
8 End-to-End System Health & Verification Pipeline 7 tests Comprehensive health diagnostics, table schemas, and full TOP lifecycle (Issue → Anchor → Verify Authentic → Tamper → Verify Tampered → Revoke).
9 Live Consortium Network & Quorum Verification 10 tests Live HTTP status polling across ports 4101/4102/4103, 2/3 majority quorum calculation ($Q \ge 2$), fault tolerance under 1 node offline, dynamic quorum loss detection, live block height synchronization, and zero private key exposure.
TOTAL All 9 Real Categories 132 tests 132 passed, 0 failed, 100% pass rate

Detailed Test Specifications (Inspectable by Hackathon Judges)

1. Multi-Node Consensus & Cluster Fault Tolerance (37 tests)

  • local_consortium_cluster.test.ts (10 tests):
    1. 3 consortium nodes start with independent HTTP listeners and genesis block at height 0
    2. Node 1 proposes block; peers validate and 2/3 majority consensus commits block across all nodes
    3. All 3 nodes converge to the exact same block hash at height 1
    4. Candidate block with invalid height is rejected by validator peers
    5. Candidate block with broken previousHash link is rejected by validator peers
    6. Candidate block with tampered transaction merkle root is rejected by validator peers
    7. Candidate block with corrupted block hash is rejected by validator peers
    8. Consensus succeeds with 2/3 majority when 1 validator node (Node 3) is offline
    9. Offline node recovers and synchronizes missing blocks from peers via catchup protocol
    10. Cluster nodes independently verify 100% valid cryptographic chain integrity after sync
  • multi_node_consensus.test.ts (15 tests):
    1. Initial cluster state: All 3 nodes have Genesis Block at height 0
    2. Leader creates valid candidate block proposal with Merkle root
    3. Validators verify candidate block successfully
    4. Validator rejects candidate with invalid height
    5. Validator rejects candidate with invalid previousHash link
    6. Full PBFT Consensus succeeds with 3/3 votes and commits to all nodes
    7. Quorum Certificate contains at least 2 valid Ed25519 signatures
    8. Sequential block production maintains continuous cryptographic chain
    9. Consensus succeeds with 2/3 quorum when 1 validator (Beta) is OFFLINE
    10. Consensus succeeds with 2/3 quorum when 1 validator (Gamma) is OFFLINE
    11. Consensus FAILS when 2 nodes are OFFLINE (Quorum lost: 1 < 2)
    12. Consensus FAILS when Leader is OFFLINE
    13. Empty transaction list is rejected by consensus engine
    14. Multi-transaction block computes combined binary Merkle tree
    15. Transaction retrieval by ID from committed blocks
  • node_fault_tolerance.test.ts (12 tests):
    1. Cluster initializes with 3 ONLINE nodes at height 0
    2. registerProof executes PBFT consensus and anchors proof across cluster
    3. failNode marks target node as OFFLINE
    4. Ledger proceeds when Node Beta is OFFLINE (Quorum = Alpha + Gamma)
    5. Second block anchored while Beta is still down
    6. Cross-node audit detects that Node Beta is behind / diverged
    7. recoverNode brings Beta back ONLINE and auto-syncs missing blocks
    8. Cross-node audit passes after Node Beta recovery
    9. Network partition prevents isolated node from voting
    10. syncNode brings partitioned Node Gamma up to cluster height
    11. Network latency simulation executes successfully without drop
    12. Revocation anchored via multi-node consensus across all nodes

2. Blockchain Integrity & Tamper Detection (23 tests)

  • ledger_tamper_detection.test.ts (12 tests):
    1. Baseline verification: All nodes have intact cryptographic chain
    2. Tamper block hash on Node Beta: detected locally by verifyLocalChainIntegrity
    3. Cross-node audit immediately detects Node Beta as DIVERGED while Alpha & Gamma are intact
    4. Quorum remains intact ($Q = 2 \ge 2$) despite Byzantine tampering on Node Beta
    5. New transactions can still be anchored while Node Beta is corrupted
    6. Self-healing: syncNode repairs tampered Node Beta from healthy peer
    7. Cross-node audit returns to consistent state after self-healing
    8. Tampering previousHash breaks chain continuity at exact height
    9. Tampering transaction payload in local database triggers Merkle leaf mismatch
    10. Repair Node Gamma brings whole cluster back to 100% integrity
    11. Direct adapter tamperNode API method updates status and triggers audit diverged flags
    12. Read-only verification does not mutate ledger data
  • provenance_tampering.test.ts (4 tests):
    1. Provenance Chain Cryptographic Integrity & Tamper Detection Suite initialization
    2. Unbroken 4-hop certified custody chain verifies as AUTHENTIC
    3. Broken chain of custody (unauthorized hop) detected as PROVENANCE_MISMATCH
    4. Forged custody signature detected as PROVENANCE_MISMATCH
  • verification.test.ts (7 tests):
    1. TRUSTGRID TOP Verification Pipeline Tests initialization
    2. Scenario 1A: Genuine Education Certificate returns AUTHENTIC with trust score >= 90
    3. Scenario 1B: Tampered Certificate (Rahul -> Rohan) detected as TAMPERED
    4. Scenario 1C: Revoked Certificate detected as REVOKED with on-chain proof
    5. Scenario 2: Genuine Product returns AUTHENTIC with 4-hop unbroken provenance
    6. Scenario 3: Tampered Legal Forensic Evidence detected as TAMPERED
    7. Consortium Blockchain Ledger Integrity validates all blocks and Merkle roots

3. Sector Flagship Protocol Validation (12 tests)

  • sector_deep_dive.test.ts (12 tests):
    1. Education: validateMetadata returns valid for complete degree payload
    2. Education: validateMetadata rejects missing mandatory attributes
    3. Education: issueDegree anchors credential on blockchain and populates credentials table
    4. Supply Chain: validateMetadata validates pharma batch payload
    5. Supply Chain: validateMetadata rejects batch without batchNumber
    6. Supply Chain: registerProductBatch anchors product batch with expiration date
    7. Supply Chain: transferProductCustody anchors certified custody event
    8. Legal: validateMetadata validates forensic evidence payload
    9. Legal: registerEvidence anchors tamper-evident forensic exhibit
    10. Legal: transferEvidenceCustody records chain of custody with jurisdiction verification
    11. Cybersecurity: registerDeviceBaseline anchors firmware baseline hash on ledger
    12. Cybersecurity: auditDevice detects firmware drift and logs on-chain alert

4. Privacy & Cryptographic Selective Disclosure (12 tests)

  • passport_disclosure.test.ts (12 tests):
    1. Full disclosure passport returns all plain metadata attributes
    2. Selective disclosure passport masks sensitive fields and sets degreeVerified flag
    3. Selective disclosure generates cryptographic salted commitments for attributes
    4. Disclosed attribute verifies mathematically against commitment and salt
    5. Tampered attribute value fails cryptographic commitment check
    6. Forged salt fails cryptographic commitment check
    7. Numeric credential generates Predicate Proof (e.g. CGPA >= 7.5)
    8. verifyPredicateProof validates predicate statement without revealing raw GPA score
    9. verifyPredicateProof rejects if tested value fails predicate threshold
    10. Reputation trust score starts high for clean active credentials
    11. Reputation trust score penalizes revoked credentials
    12. Non-existent DID returns null safely

5. Production Hyperledger Fabric Smart Contract (10 tests)

  • fabric_contract.test.ts (10 tests):
    1. Production adapter reports transparent connection status & contract readiness
    2. registerProof writes to Fabric World State with block and Merkle leaf
    3. verifyProof returns valid when content hash matches World State
    4. verifyProof flags mismatch as TAMPERED
    5. verifyProof returns false for non-existent object
    6. revokeProof transitions status to REVOKED on Fabric ledger
    7. addProvenanceEvent anchors certified custody handoff on Fabric
    8. recordSecurityEvent anchors firmware compromise alert on Fabric
    9. Fabric ledger integrity check validates all block headers and previous hashes
    10. Fabric Go Chaincode source file (trustgrid_cc.go) exists and contains all required methods

6. Decentralized Identity & Encrypted Keystores (10 tests)

  • crypto.test.ts (5 tests):
    1. Cryptographic Primitive Suite initialization
    2. Ed25519 key generation, signing, and verification
    3. Canonical RFC 8785 JSON deterministic serialization & SHA-256
    4. AES-256-GCM private key encryption and decryption with authentication tag
    5. Binary Merkle tree root computation and leaf verification
  • persistence.test.ts (5 tests):
    1. Persistent Encrypted Keystore & Server Restart Integrity Suite initialization
    2. Key Persistence: Consortium Notary retains identical keypair across simulated restarts
    3. Ledger Persistence: Blockchain integrity remains 100% VALID after restart
    4. Object Persistence: Trust Object created before restart verifies as AUTHENTIC after restart
    5. Revocation Persistence: Revoked object remains REVOKED after restart

7. Risk Engine & Anomaly Detection (11 tests)

  • anomaly.test.ts (4 tests):
    1. Anomaly Risk Engine calculates baseline risk score
    2. Object status penalty scoring
    3. Verification velocity spike anomaly scoring
    4. Geolocation impossibility anomaly scoring
  • duplicate_credential.test.ts (2 tests):
    1. Duplicate Credential Claim & Anomaly Risk Suite initialization
    2. Identical credential content claimed across multiple subject DIDs triggers DUPLICATE_CREDENTIAL_CLAIM
  • cybersecurity_e2e.test.ts (5 tests):
    1. SCADA device cryptographic baseline registration
    2. Firmware hash verification against immutable ledger baseline
    3. Firmware bit-drift detection triggering CRITICAL security alert
    4. Immutable security incident anchoring to consortium ledger
    5. Explainable Risk Engine elevation to High/Critical upon baseline breach

8. End-to-End System Integration & Health (7 tests)

  • e2e.test.ts (1 test):
    1. Full End-to-End Trust Object Protocol (TOP) Lifecycle (Issue → Anchor → Verify Authentic → Tamper → Verify Tampered → Revoke)
  • system_health.test.ts (6 tests):
    1. System Health & All 4 Flagship Demo Scenarios Suite initialization
    2. System Diagnostics: Ledger integrity is valid and all tables are ready
    3. Scenario 1 (Education): Genuine vs Tampered Certificate
    4. Scenario 2 (Supply Chain): Genuine vs Counterfeit Batch
    5. Scenario 3 (Legal Evidence): Genuine vs Tampered Forensics
    6. Scenario 4 (Cybersecurity): Clean Gateway vs Compromised SCADA Device

9. Live Consortium Network & Quorum Verification (10 tests)

  • network_status.test.ts (10 tests):
    1. All 3 nodes online: Network reports HEALTHY with 3/3 quorum and READY consensus
    2. One node offline: Network reports DEGRADED with 2/3 nodes online
    3. Quorum still available with 2 of 3 nodes online (2/3 majority preserved)
    4. Quorum lost when fewer than 2 nodes are online (e.g. 1/3 available)
    5. Correct block height reporting across nodes
    6. Correct node roles assigned: Alpha is PROPOSER, Beta and Gamma are VALIDATORS
    7. Unreachable/unresponsive node port is handled safely without throwing
    8. Security: Network Status API does not expose private keys, seeds, or internal secrets
    9. Real HTTP query to /api/network/status detects running node on port 4102 as ONLINE and unstarted nodes as OFFLINE
    10. Toggling node status via POST /api/network/nodes/beta/toggle sets node OFFLINE dynamically

11. Project Folder Structure

TRUSTGRID/
├── package.json                   # Root package script configuration (Node 24+, tsx, vite)
├── tsconfig.json                  # Server TypeScript configuration
├── Dockerfile                     # Multi-stage production container build
├── docker-compose.yml             # Single-instance Docker Compose orchestration
├── docker-compose.multi-node.yml  # 3-Node PBFT containerized cluster orchestration
├── .env.example                   # Complete configuration reference
├── README.md                      # Comprehensive project overview
├── docs/
│   ├── ARCHITECTURE_AUDIT.md      # Phase 0 baseline audit & v2 architectural roadmap
│   ├── DISTRIBUTED_LEDGER.md      # Distributed ledger architecture & node topology
│   ├── CONSENSUS.md               # 3-Phase PBFT consensus protocol & quorum math
│   ├── SECURITY.md                # Threat model & cryptographic defense-in-depth
│   └── DEMO_SCRIPT.md             # SIH 2026 Judge Demonstration Guide
├── src/
│   ├── server.ts                  # Server entrypoint with auto-seeding
│   ├── app.ts                     # Express app assembly, audit logging & multi-node router
│   ├── core/
│   │   ├── crypto/                # Ed25519, SHA-256 canonical hash, AES-GCM, Merkle trees
│   │   ├── identity/              # W3C DIDs & encrypted keystore wallet
│   │   ├── trust-object/          # Trust Object Protocol (TOP v2) types & service
│   │   ├── blockchain/
│   │   │   ├── node.ts            # LedgerNode class with isolated SQLite & Ed25519 DID
│   │   │   ├── network.ts         # PeerNetwork router with latency & partition simulation
│   │   │   ├── consensus.service.ts # 3-Phase PBFT Consensus Engine (Propose/Endorse/Commit)
│   │   │   ├── multi-node-blockchain.adapter.ts # 3-Node cluster manager (Alpha/Beta/Gamma)
│   │   │   ├── consortium-blockchain.adapter.ts # Primary consortium ledger adapter
│   │   │   ├── production-blockchain.adapter.ts # Hyperledger Fabric gateway bridge
│   │   │   └── fabric-chaincode/
│   │   │       ├── trustgrid_cc.go # Production Hyperledger Fabric 2.5 Go Smart Contract
│   │   │       └── go.mod         # Go module definition
│   │   ├── verification/          # 5-Step Cryptographic Verification Pipeline + PBFT Check
│   │   ├── provenance/            # Certified multi-party custody handoffs
│   │   ├── revocation/            # On-chain revocation registry
│   │   ├── risk-engine/           # Explainable Trust Risk Engine (0-100)
│   │   ├── trust-graph/           # Cross-sector entity relationship graph
│   │   └── passport/              # Trust Passport with salted commitments & range proofs
│   ├── sectors/                   # Sector modules validating TOP
│   │   ├── sector.interface.ts
│   │   ├── education.module.ts    # Academic degrees & transcript verification
│   │   ├── supply-chain.module.ts # Pharma batches & cold-chain custody tracking
│   │   ├── legal.module.ts        # Tamper-evident forensic evidence & chain of custody
│   │   └── cybersecurity.module.ts # SCADA firmware baselines & on-chain drift alerts
│   ├── database/
│   │   ├── schema.sql             # Relational DDL & schema migrations
│   │   ├── db.service.ts          # Built-in node:sqlite database service
│   │   └── seed.ts                # Idempotent demonstrator seed data
│   ├── api/routes/                # REST endpoints (/api/nodes, /api/network/status, /api/verify, etc.)
│   └── tests/                     # 132 Automated Tests (Consensus, Quorum, Fault Tolerance, Tamper, Sectors)
└── client/
    ├── package.json
    ├── vite.config.ts             # Vite dev server with proxy to port 5000
    ├── index.html
    └── src/
        ├── App.tsx                # Master UI router and cyber layout
        ├── index.css              # Custom dark-mode cybersecurity design system
        ├── components/
        │   ├── Navbar.tsx         # Sector navigation, network status & role switcher
        │   ├── DemoBanner.tsx     # SIH 1-click flagship scenario buttons
        │   ├── HeroVerification.tsx # Signature UI with 7-point checklist & hash diff
        │   ├── TrustGraphView.tsx # Interactive SVG node-link graph
        │   └── TrustPassportCard.tsx # Privacy-preserving passport viewer
        ├── pages/
        │   ├── NetworkStatusPage.tsx # Real-time 3-Node Consortium Health & Quorum Monitor
        │   ├── BlockchainExplorerPage.tsx # Multi-Node PBFT Visualizer & Node Control Panel
        │   └── ...                # Sector & audit views
        └── services/api.ts        # Frontend REST API client

12. Verification & Automated Test Suite Summary

TRUSTGRID features a comprehensive automated test suite consisting of 132 automated test assertions • 0 failed (132 passing, 0 failing across 9 test categories / 17 test files) executing in ~5.7 seconds.

# Run all verified tests (132 tests • 0 failed)
npm test

# Run interactive 3-node consortium consensus demo
npm run demo:consortium

# Run verification latency benchmark
npm run benchmark

For the complete categorized breakdown and file-by-file test specifications, see §10. Automated Test Validation & Verification Suite.


13. Future Scope & Roadmap

  1. Zero-Knowledge Range Proofs (zk-SNARKs): Integrating Groth16 / Circom circuits to prove age, credentials, or batch expiry without revealing any numerical attributes.
  2. Cross-Chain State Anchoring: Relaying consortium Merkle state roots onto public networks (Polygon / Ethereum) for public notary anchoring.
  3. Decentralized Storage Connectors: Optional IPFS / Filecoin pinning for large non-sensitive public assets.
  4. Hardware Security Module (HSM) Support: Integrating PKCS#11 / AWS KMS / Azure Key Vault for institutional private key signing.

14. License

Apache License 2.0. Built for Smart India Hackathon 2026.

About

A universal decentralized trust layer for independently verifying digital information across Education, Supply Chain, Legal Evidence, and Cybersecurity.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages