Skip to content

F1reC/matterLog---web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MatterLog

MatterLog

真实数据认证与交易平台
Proof of Reality — Authenticate, Verify & Trade Real-World Data

中文 | English


中文

问题

AI 生成的图片和视频已经以假乱真,没有人能分辨真假。如何证明一张照片是真实拍摄的,而不是 AI 生成的?

解决方案

MatterLog 通过硬件级加密签名 + 链上存证来证明数据真实性。每一张照片、视频、动捕数据在拍摄瞬间由硬件加密芯片签名,并注册到链上铸造为 PoR NFT。

任何人都可以验证 — 无需注册。

L1–L5 真实性等级

类比自动驾驶的 L1–L5 等级,数据真实性也分等级:

等级 采集方式 信任依据
L1 未知来源 无验证
L2 软件拍摄(手机/网页) 软件级哈希
L3 硬件设备(图片) 设备签名图片
L4 硬件加密相机(视频) 加密芯片签名视频
L5 硬件 + 动捕 多模态对齐 — AI 无法生成

核心逻辑:AI 能生成的模态,等级就低;AI 暂时无法生成的模态,等级就高。

系统架构

┌─────────────┐     ┌─────────────────┐     ┌──────────────┐
│  RealCam    │────▶│  MatterLog      │────▶│  区块链       │
│  硬件端      │     │  软件平台       │     │  Base Sepolia│
│             │     │                 │     │              │
│ • 双目相机   │     │ • FastAPI       │     │ • PoR NFT    │
│ • ATECC608B │     │ • React + TS    │     │ • ERC-721    │
│ • 本地哈希   │     │ • SQLite        │     │ • 链上存证    │
│ • 硬件签名   │     │ • Gas 代付      │     │              │
└─────────────┘     └─────────────────┘     └──────────────┘
  • 硬件端 (RealCam/):树莓派 + 双目鱼眼相机 + ATECC608B 加密芯片 + 动捕设备
  • 后端 (backend/):FastAPI + SQLite + web3.py,支持 mock/real 两种区块链模式
  • 前端 (frontend/):Vite + React + TypeScript + Tailwind CSS,支持中英文切换
  • 智能合约 (RealCam/ProofOfReality.sol):ERC-721,部署在 Base Sepolia

快速启动

后端

cd backend
pip install -r requirements.txt

# Mock 模式(默认,不需要连链)
python3 -m uvicorn main:app --reload --port 8000

# Real 模式(连接 Base Sepolia 真实上链)
cp .env.example .env  # 填入 ATTESTOR_PRIVATE_KEY
python3 -m uvicorn main:app --reload --port 8000

前端

cd frontend
npm install
npm run dev  # http://localhost:5173

环境变量

变量 默认值 说明
BLOCKCHAIN_MODE mock mockreal
ATTESTOR_PRIVATE_KEY 链上交易钱包私钥
RPC_URL https://sepolia.base.org 区块链 RPC 节点
CONTRACT_ADDRESS 0x1119...6bC5 ProofOfReality 合约地址

核心功能

1. 数据上传与链上存证

硬件拍摄 → 计算 SHA-256 哈希 → 加密芯片签名 → 上传平台 → 平台代付 Gas 上链 → 铸造 PoR NFT

2. 开放验证

任何人拖入文件到验证页面,自动计算哈希并比对链上记录,无需注册。

3. 数据市场

已认证数据带 L1–L5 等级标签上架,支持预览和购买。已售数据标记 SOLD 不消失。

4. Gas 代付

用户不需要钱包、不需要付 Gas,平台统一代付,从交易分成中回收。

5. 视频 + 动捕

支持视频上传(带进度条)、.ts 格式自动转 MP4、关联动捕数据展示。

6. 自动定价

根据数据类型(图片/视频/动捕)、真实性等级(L1–L5)、文件大小自动估算价值。

API 接口

方法 路径 说明
POST /api/data/upload 上传文件 + 哈希 + 签名
POST /api/verify 按哈希验证
POST /api/verify/file 按文件验证
GET /api/data 市场列表
GET /api/data/{id} 数据详情 + 关联动捕
GET /api/data/{id}/preview 文件预览(.ts 自动转码)
DELETE /api/data/{id} 删除记录
POST /api/trade/buy 购买数据
GET /api/chain/records 链上确权记录
GET /api/devices 设备列表与 Gas 消耗

智能合约

ProofOfRealityProtocol — 部署在 Base Sepolia

  • 地址:0x11198C43b41e74c7bbf82FB6d9BF59b82CA86bC5
  • 标准:ERC-721(PoR NFT)
  • 核心函数:attestSessionregisterDeviceslashDeviceinvalidateSession
  • 设计理念:链下硬件校验 + 链上摘要存证

哈希算法

字段 算法 输入
sessionHash SHA-256 文件二进制内容
deviceIdHash Keccak-256 设备 ID 字符串
proofDigest SHA-256 哈希 + 签名拼接

详见 HASH_SPEC.md


English

Problem

AI-generated images and videos are now indistinguishable from real ones. How do you prove a photo was actually captured by a real camera, not fabricated by AI?

Solution

MatterLog combines hardware-level cryptographic signing with on-chain attestation to prove data authenticity. Every photo, video, and motion-capture session is signed at the hardware level and registered on-chain as an NFT (PoR Token).

Anyone can verify — no account needed.

L1–L5 Authenticity Levels

Inspired by autonomous driving levels, we classify data trustworthiness:

Level Source Trust Basis
L1 Unknown origin No verification
L2 Software capture (phone/web) Software-level hash
L3 Hardware device (image) Device-signed image
L4 Hardware encrypted camera (video) Crypto-chip signed video
L5 Hardware + Motion Capture Multi-modal alignment — AI cannot generate this

The higher the level, the harder it is for AI to fake.

Architecture

┌─────────────┐     ┌─────────────────┐     ┌──────────────┐
│  RealCam    │────▶│  MatterLog      │────▶│  Blockchain  │
│  Hardware   │     │  Platform       │     │  Base Sepolia│
│             │     │                 │     │              │
│ • Dual cam  │     │ • FastAPI       │     │ • PoR NFT    │
│ • ATECC608B │     │ • React + TS    │     │ • ERC-721    │
│ • Local hash│     │ • SQLite        │     │ • On-chain   │
│ • HW sign   │     │ • Gas sponsor   │     │   attestation│
└─────────────┘     └─────────────────┘     └──────────────┘
  • Hardware (RealCam/): Raspberry Pi + dual fisheye cameras + ATECC608B crypto chip + motion capture
  • Backend (backend/): FastAPI + SQLite + web3.py, supports mock/real blockchain modes
  • Frontend (frontend/): Vite + React + TypeScript + Tailwind CSS, i18n (中文/EN)
  • Smart Contract (RealCam/ProofOfReality.sol): ERC-721 on Base Sepolia

Quick Start

Backend

cd backend
pip install -r requirements.txt

# Mock mode (default, no blockchain needed)
python3 -m uvicorn main:app --reload --port 8000

# Real mode (connects to Base Sepolia)
cp .env.example .env  # fill in ATTESTOR_PRIVATE_KEY
python3 -m uvicorn main:app --reload --port 8000

Frontend

cd frontend
npm install
npm run dev  # http://localhost:5173

Environment Variables

Variable Default Description
BLOCKCHAIN_MODE mock mock or real
ATTESTOR_PRIVATE_KEY Wallet private key for on-chain transactions
RPC_URL https://sepolia.base.org Blockchain RPC endpoint
CONTRACT_ADDRESS 0x1119...6bC5 ProofOfReality contract address

Core Features

  1. Data Upload & On-chain Attestation — Hardware capture → SHA-256 hash → crypto-chip signing → platform upload → on-chain registration → PoR NFT minting
  2. Open Verification — Drag any file to verify, auto-computes hash and checks on-chain records. No account needed.
  3. Data Marketplace — Verified data listed with L1–L5 badges, preview and purchase support.
  4. Gas Sponsorship — Users don't pay gas. Platform sponsors all transactions.
  5. Video + Motion Capture — Video upload with progress bar, .ts auto-transcoding, linked mocap data display.
  6. Auto Pricing — Estimates data value based on type, authenticity level, and file size.

API Endpoints

Method Path Description
POST /api/data/upload Upload file + hash + signature
POST /api/verify Verify by hash
POST /api/verify/file Verify by file upload
GET /api/data Marketplace listing
GET /api/data/{id} Data detail + linked mocap
GET /api/data/{id}/preview File preview (auto-transcodes .ts)
DELETE /api/data/{id} Delete record
POST /api/trade/buy Purchase data
GET /api/chain/records On-chain attestation records
GET /api/devices Device list & gas usage

Smart Contract

ProofOfRealityProtocol — deployed on Base Sepolia

  • Address: 0x11198C43b41e74c7bbf82FB6d9BF59b82CA86bC5
  • Standard: ERC-721 (PoR NFT)
  • Key functions: attestSession, registerDevice, slashDevice, invalidateSession
  • Design: Off-chain hardware verification + on-chain digest storage

Hash Algorithms

Field Algorithm Input
sessionHash SHA-256 File binary content
deviceIdHash Keccak-256 Device ID string
proofDigest SHA-256 Hash + signature combined

See HASH_SPEC.md for details.


Built at the Xiaohongshu Hackathon (小红书黑客松) — April 2026

MIT License

About

#Redhackathon

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors