Skip to content

A blockchain-based verification system for tracking and verifying product authenticity and ownership. Used in SUPPLY: THE FUTURE apparel.

License

Notifications You must be signed in to change notification settings

jiaweing/verify.supply.tf

verify.supply.tf

A blockchain-based physical asset verification and ownership tracking system built for SUPPLY: THE FUTURE apparel.

TypeScript Next.js PostgreSQL Blockchain License: AGPL v3

Overview

verify.supply.tf is a robust blockchain-based verification system designed to track and verify the authenticity and ownership of physical products. It creates an immutable digital record for each item, enabling secure ownership transfers and authenticity verification through NFC integration.

Features

Feature Description
πŸ”’ Blockchain Verification Immutable history tracking using a custom blockchain implementation
πŸ‘€ Ownership Management Secure transfer system with email verification
🏷️ NFC Integration Physical-digital product linkage through NFC tags
πŸ“± Mobile-First Design Responsive interface optimized for mobile verification
πŸ” Audit Trail Complete historical record of ownership transfers
πŸ›‘οΈ Tamper Protection Cryptographic verification of product authenticity

Blockchain Architecture

Block Structure

classDiagram
    class Block {
        +blockNumber: number
        +timestamp: string
        +previousHash: string
        +merkleRoot: string
        +blockNonce: number
        +calculateHash()
        +verifyTransaction()
    }

    class Transaction {
        +type: string
        +itemId: string
        +timestamp: string
        +nonce: string
        +data: object
    }

    Block "1" *-- "many" Transaction
Loading

Chain Verification Flow

graph TB
    A[New Block] -->|Hash| B{Verify Previous Hash}
    B -->|Valid| C{Check Block Number}
    C -->|Valid| D{Verify Merkle Root}
    D -->|Valid| E{Verify Transactions}
    E -->|Valid| F[Block Accepted]

    B -->|Invalid| X[Reject Block]
    C -->|Invalid| X
    D -->|Invalid| X
    E -->|Invalid| X
Loading

Merkle Tree Implementation

graph TB
    subgraph Merkle Tree
    R[Root Hash] --- H1[Hash 1-2]
    R --- H2[Hash 3-4]
    H1 --- T1[Transaction 1]
    H1 --- T2[Transaction 2]
    H2 --- T3[Transaction 3]
    H2 --- T4[Transaction 4]
    end

    V[Verify Transaction] --> P[Build Proof]
    P --> C{Check Against Root}
    C -->|Match| Valid[Valid Transaction]
    C -->|No Match| Invalid[Invalid Transaction]
Loading

Ownership Transfer Process

sequenceDiagram
    participant Current Owner
    participant System
    participant Blockchain
    participant New Owner

    Current Owner->>System: Initiate Transfer
    System->>System: Generate Transfer Nonce
    System->>New Owner: Send Confirmation Email
    New Owner->>System: Confirm Transfer
    System->>Blockchain: Create Transfer Block
    Blockchain->>Blockchain: Verify Chain Integrity
    Blockchain->>System: Confirm Transfer
    System->>Current Owner: Send Transfer Complete
    System->>New Owner: Send Ownership Confirmation
Loading

Technical Implementation

Core Components

πŸ”’ Security Features

  • Nonce Verification
    64-character hex nonce prevents replay attacks
  • Timestamp Normalization
    Millisecond precision for reliable hashing
  • Merkle Tree Proofs
    Efficient transaction verification system
  • Chain Integrity
    Continuous block link verification
  • Data Immutability
    Cryptographic protection of records

πŸ—οΈ Data Structures

// Block Structure
interface BlockData {
  blockNumber: number;
  timestamp: string;
  previousHash: string;
  merkleRoot: string;
  blockNonce: number;
}

// Transaction Record
interface TransactionData {
  type: "create" | "transfer";
  itemId: string;
  timestamp: string;
  nonce: string;
  data: {
    from?: {
      name: string;
      email: string;
    };
    to: {
      name: string;
      email: string;
    };
    item: ItemDetails;
  };
}

Setup and Installation

Prerequisites

  • Node.js 18+
  • PostgreSQL 15+
  • pnpm (recommended)

Quick Start

  1. Clone and install dependencies:
git clone https://github.com/jiaweing/verify.supply.tf.git
cd verify.supply.tf
pnpm install
  1. Configure environment:
cp .env.example .env
# Edit .env with your settings
  1. Initialize database:
pnpm db:push
pnpm db:seed
  1. Start development server:
pnpm dev

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3).

See the LICENSE file for details.


Built with ❀️ for SUPPLY: THE FUTURE

About

A blockchain-based verification system for tracking and verifying product authenticity and ownership. Used in SUPPLY: THE FUTURE apparel.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages