Skip to content

Latest commit

 

History

History
265 lines (200 loc) · 10.7 KB

File metadata and controls

265 lines (200 loc) · 10.7 KB

ACTUS-FHD: Confidential Finance with ACTUS Standard and Post-Quantum Security

PL_Genesis: Frontiers of Collaboration Hackathon — Zama × Protocol Labs × ACTUS

Go React TypeScript Zama FHEVM NIST PQC


🎯 What is ACTUS-FHD?

ACTUS-FHD is a full-stack demonstration system that integrates three cutting-edge technologies to solve a critical challenge in decentralized finance: How can financial contracts execute on-chain with both privacy AND quantum-resistant security?

Layer Technology Purpose
📐 Financial Engine ACTUS Standard (PAM, ANN, SWAPS) Precise cashflow scheduling & risk modeling
🔐 Confidential Computation Zama FHEVM (TFHE.sol, euint256) On-chain encrypted balance & coupon operations
🛡️ Post-Quantum Security ML-DSA-65 (FIPS 204) + ML-KEM-768 (FIPS 203) Quantum-resistant signatures & key exchange

Architecture

┌──────────────────────────────────────────────────────────────────┐
│                     React Frontend (Vite + TS)                   │
│   Scenario Cards → Run Scenarios → 7-Tab Results Dashboard       │
├──────────────────────────────────────────────────────────────────┤
│                      Go HTTP API (:8080)                         │
│   GET /api/scenarios │ POST /api/run │ POST /api/run-all         │
├──────────┬───────────┬───────────┬───────────┬──────────────────┤
│  ACTUS   │    FVM    │  FHEVM    │    PQC    │   ISO 20022      │
│  Client  │  Client   │  Codegen  │  Client   │   Generator      │
│ PAM/ANN  │ Lifecycle │ euint256  │ ML-DSA-65 │  pacs.008        │
│ SWAPS    │ Settlement│ TFHE.sol  │ ML-KEM-768│  sese.023        │
├──────────┴───────────┴───────────┴───────────┴──────────────────┤
│              4 Financial Scenarios (Stablecoin / Bond /           │
│              SME Loan / Interest Rate Swap)                      │
└──────────────────────────────────────────────────────────────────┘

🚀 Quick Start

Prerequisites

  • Go ≥ 1.24
  • Node.js ≥ 20 with npm
  • actus-go library (local dependency)
  • ml-kem-go and ml-dsa-go libraries (local dependencies)

1. Clone & Install

git clone https://github.com/smpebble/Frontiers-of-Collaboration-Hackathon_ACTUS-FHD_Demo
cd Frontiers-of-Collaboration-Hackathon_ACTUS-FHD_Demo

# Install Go dependencies
go mod tidy

# Install React frontend dependencies
cd web && npm install && cd ..

2. Run CLI Demo

go run main.go

This executes all 4 financial scenarios with live PQC signing and FHEVM contract generation:

══════════════════════════════════════════════════════════════════════
  ACTUS-FHD: Confidential Finance with Post-Quantum Security
  
  Integrated Stack:
    • ACTUS Financial Contract Engine (PAM / ANN / SWAPS)
    • Zama FHEVM (Fully Homomorphic Encryption on EVM)
    • ML-DSA-65 (FIPS 204 Post-Quantum Digital Signatures)
    • ML-KEM-768 (FIPS 203 Post-Quantum Key Encapsulation)
══════════════════════════════════════════════════════════════════════

  ✅ Stablecoin (TWDX) — 3 events, 3 PQC sigs, 901ms
  ✅ Corporate Bond (5Y) — 13 events, 13 PQC sigs, 320ms
  ✅ SME Loan (60M) — 181 events, 181 PQC sigs, 925ms
  ✅ Interest Rate Swap — 39 events, 39 PQC sigs, 362ms

3. Run Web UI

# Start Go backend
go run cmd/server/main.go

# In another terminal — start React dev server
cd web && npm run dev

Open http://localhost:5173 to access the dashboard.

4. Build for Production

cd web && npm run build && cd ..
go run cmd/server/main.go
# Open http://localhost:8080

💰 Financial Scenarios

1. Stablecoin (TWDX)

  • ACTUS Type: PAM (Principal at Maturity)
  • Description: 1:1 TWD-backed stablecoin with mint/redeem operations
  • FHE: Encrypted balances and totalSupply (euint256)
  • PQC: ML-DSA-65 signatures on mint/burn events
  • Precision: Exact 1:1 mapping (diff = 0)

2. Corporate Bond (5Y, 3.5%)

  • ACTUS Type: PAM with semi-annual coupons
  • Description: 100M TWD bond, Act/360 day count, 10 coupon payments + principal
  • FHE: Encrypted coupon amounts, face value, and accrued interest
  • PQC: ML-DSA-65 signatures on 13 cashflow events
  • Precision: First coupon diff = 0.0000000002

3. SME Loan (60M, 4.5%)

  • ACTUS Type: ANN (Annuity)
  • Description: 50M TWD, 5-year, monthly amortization
  • FHE: Encrypted loan balance, payment amount, and interest accrued
  • PQC: ML-DSA-65 signatures on 181 events
  • Precision: PMT formula diff = 0.0000000031

4. Interest Rate Swap (3Y)

  • ACTUS Type: SWAPS (dual PAM legs)
  • Description: Fixed 3.0% vs TAIBOR+50bps, 100M TWD notional
  • FHE: Encrypted netting amount, fixed leg, and floating leg
  • PQC: ML-DSA-65 signatures on 39 events
  • Precision: Net settlement diff = 0.00000000006

🔐 FHE Integration (Zama FHEVM)

The system generates FHEVM-compatible Solidity contracts that use Zama's encrypted types:

Standard Type FHEVM Type Operation
uint256 balance euint256 balance TFHE.asEuint256()
transfer(to, amount) transfer(to, einput, bytes) TFHE.sub() / TFHE.add()
balanceOf(addr) balanceOf(addr, bytes32, bytes) TFHE.allow() access control

Generated contracts are stored in generated/fhevm/ with full Solidity source code viewable in the React UI.


🛡️ PQC Integration (NIST FIPS 203/204)

ML-DSA-65 (Digital Signatures)

  • Every ACTUS cashflow event is signed with ML-DSA-65
  • Signatures are verified immediately after signing
  • Total: 236 events signed across all 4 scenarios

ML-KEM-768 (Key Encapsulation)

  • Off-chain key exchange simulation for secure communication
  • Generates shared secret (32 bytes) between counterparties
  • SHA-256 hash of shared secret is included in results

📁 Project Structure

actus-fhd/
├── cmd/
│   ├── demo/main.go          # CLI demo runner
│   └── server/main.go        # HTTP API server
├── internal/
│   ├── adapter/               # 7 adapters
│   │   ├── actus_client.go    # ACTUS engine (PAM/ANN)
│   │   ├── fvm_client.go      # FVM lifecycle
│   │   ├── codegen_client.go  # Standard Solidity codegen
│   │   ├── fhevm_codegen_client.go # FHEVM Solidity codegen
│   │   ├── pqc_client.go      # ML-DSA + ML-KEM
│   │   ├── iso20022_client.go # ISO 20022 XML messages
│   │   └── vlei_client.go     # vLEI identity verification
│   ├── api/server.go          # HTTP API with CORS
│   ├── demo/runner.go         # Scenario orchestrator
│   ├── model/                 # 5 domain model files
│   └── scenarios/             # 5 scenario files
│       ├── common.go          # Shared context + signAndEncrypt
│       ├── stablecoin.go      # TWDX scenario
│       ├── bond.go            # Corporate bond
│       ├── loan.go            # SME loan
│       └── derivative.go      # Interest rate swap
├── web/                       # React frontend (Vite + TypeScript)
│   └── src/
│       ├── App.tsx            # Main UI with 7 result tabs
│       ├── api.ts             # API client
│       ├── types.ts           # TypeScript type definitions
│       ├── index.css          # Design system (dark mode)
│       └── App.css            # Component styles
├── generated/                 # Generated Solidity contracts
│   ├── fhevm/                 # FHEVM confidential contracts
│   └── standard/              # Standard contracts
├── Docs/                      # Project documentation (Chinese/English)
├── Temps/                     # Development tracking
├── main.go                    # CLI entry point
└── go.mod                     # Go module definition

🧪 Verification Results

Metric Value
Go Build go build ./... — clean compile
CLI Demo ✅ All 4 scenarios pass
React Build ✅ TypeScript + Vite production build
Browser Test ✅ All tabs verified (Cashflows/FHE/PQC/Solidity/ISO20022/Precision/vLEI)
Total Events 236 ACTUS cashflow events
PQC Signatures 236 ML-DSA-65 signatures (all verified ✅)
FHE Fields 11 encrypted fields across 4 scenarios
FHEVM Contracts 4 Solidity contracts generated
Precision Tests All passing (max diff: 1.87e-7)

🛠️ Technology Stack

Component Technology Version
Backend Go 1.24
Frontend React + TypeScript 19 + 5.7
Build Tool Vite 7.3
ACTUS Engine actus-go Local
PQC Signatures ml-dsa-go (FIPS 204) ML-DSA-65
PQC Key Exchange ml-kem-go (FIPS 203) ML-KEM-768
FHE Contracts Zama FHEVM TFHE.sol
Decimal Math shopspring/decimal v1.4
UUID google/uuid v1.6

📜 License

Apache 2.0 License — see LICENSE for details.


👥 Team

ACTUS-FHD — Built for the PL_Genesis: Frontiers of Collaboration Hackathon

Integrating ACTUS financial contract standards with Zama's Fully Homomorphic Encryption and NIST Post-Quantum Cryptography to enable confidential, quantum-resistant decentralized finance.