- Competition: Shenzhen International FinTech Competition (FinTechathon 2026) β International Track
- Topic: Topic F β Agent Wallet (Autonomous On-Chain Wallet)
- Co-Hosts: Tsinghua University PBCSF & WeBank
- Landing Page:
https://www.tec-c.xyz - Repository:
https://github.com/AhmedFouad15/TEC-C
Detailed architectural breakdowns, run guides, and econometric specifications are available in the dedicated docs/ folder:
| Part / Folder | Subject | Description |
|---|---|---|
docs/01_system_architecture/ |
Multi-Agent Design | 3-Member execution model, LangGraph cognitive state machine, and dual-server IPC |
docs/02_prerequisites_and_run_guide/ |
Run & Deploy Manual | Step-by-step setup (Python, Foundry, WSL 2), test execution, and deployment commands |
docs/03_market_data_feeds_and_apis/ |
Feeds & Free Alternatives | $0.00 zero-cost design, free public endpoints, and enterprise feed comparative matrix |
docs/04_multichain_and_fisco_bcos/ |
Multi-Chain & Node Cluster | FISCO BCOS testnet cluster setup, millisecond EVM nuance, and auto-supervisor |
docs/05_fail_closed_strictness_hierarchy/ |
Math > AI Hierarchy | Tsinghua academic formulation, asymmetric bounding proofs ( |
docs/06_privacy_anchors_and_slippage/ |
Audit & Slippage Engine | SHA-256 anchors on FISCO BCOS, orderbook thinning recovery ( |
docs/07_defi_protocols_and_routing/ |
Protocol Registry | Verified contracts, ABIs, function selectors, and risk tiers (Lido, Aave, Curve, Uniswap) |
docs/08_smart_contracts/ |
Smart Contracts Vault | ERC-7579 vault, EIP-712 session key validator, RIP-7212 precompile 0x100, gas matrix |
docs/09_pegguard_arbitrage_framework/ |
PegGuard Arbitrage Framework | 5-layer quantitative funnel, Markov regimes, 25-asset universe, 24/7 autonomous daemon & watermark memory |
docs/pdf/ |
Original Whitepapers (PDF) | Complete archive of all 9 original technical PDF whitepapers, engineering masterplans, and roadmap guides |
TEC-C/
βββ agent/ # Off-Chain AI Brain & Execution Engines
β βββ tecc_brain/
β β βββ api/ # FastAPI Endpoints (Mandate, Risk, Profile, Arbitrage, Biometrics)
β β βββ biometrics/ # WebAuthn NIST P-256 Passkey Biometric Engine
β β βββ graph/ # LangGraph Multi-Agent Cognitive Pipeline & Intent Sieve
β β βββ market/ # Live Market Data Feeds & Free Alternative Catalogs
β β βββ onchain/ # Multi-Chain Executors, Relayers, Oracles & FISCO Node Supervisor
β β βββ pegguard/ # Autonomous 25-Asset Scanner & Stateful Watermark Memory
β β βββ sentinel/ # Fear & Greed, Grok, and Multi-Oracle Sentiment
β β βββ strategy/ # Autonomous Playbooks & Portfolio Risk Engine
β β βββ virtual_session/ # Remote Phone Access Gateway & Cloudflare Quick-Tunnel
β β βββ app.py # FastAPI Application Entrypoint (Port 8000)
β βββ tests/ # 1,663 Unit, Property & Integration Tests
βββ contracts/ # Smart Contracts Layer (Foundry)
β βββ src/ # Production Smart Contracts (100% NatSpec)
β β βββ TecAccount.sol # ERC-7579 Modular Smart Account
β β βββ audit/
β β β βββ PrivacyAuditAnchor.sol # Cryptographic Audit Anchor on FISCO BCOS
β β βββ hooks/
β β β βββ TetherGuardHook.sol # Dual-Axis Policy Hook & Invariant Engine
β β βββ validators/
β β β βββ P256Verifier.sol # RIP-7212 0x100 + Pure-Solidity P-256 Curve Fallback
β β β βββ SessionKeyValidator.sol # EIP-712 AI Agent Mandate Validator
β β β βββ WebAuthnP256Validator.sol # Hardware Passkey / Biometric Validator
β β βββ paymaster/
β β β βββ TecPaymaster.sol # ERC-4337 Gas Sponsorship & Anti-Griefing
β β βββ interfaces/ # Standard ERC & Chainlink Interfaces
β βββ test/ # 14 Foundry Test Suites (170 passing tests)
β βββ foundry.toml # Compiler & optimizer configuration
β βββ README.md # Smart contracts deep dive
βββ docs/ # Comprehensive Technical & Architectural Documentation
β βββ 01_system_architecture/ # Architecture, Multi-Agent & Transcribed Roadmaps
β βββ 02_prerequisites_and_run_guide/ # Run & Deployment Manuals
β βββ 03_market_data_feeds_and_apis/ # Zero-Cost Feeds & Enterprise Alternatives
β βββ 04_multichain_and_fisco_bcos/ # 4-Chain Setup & FISCO BCOS Supervisor
β βββ 05_fail_closed_strictness_hierarchy/ # Math > AI Asymmetric Governance
β βββ 06_privacy_anchors_and_slippage/ # Banking Secrecy SHA-256 & Recovery
β βββ 07_defi_protocols_and_routing/ # Verified Multi-Chain Protocol Registry
β βββ 08_smart_contracts/ # Vault, Hook, Gas & Security Benchmarks
β βββ 09_pegguard_arbitrage_framework/ # 5-Layer Funnel, 24/7 Daemon & Watermark Memory Spec
β βββ pdf/ # Complete Collection of 9 Original PDF Whitepapers
βββ shared/
β βββ api_spec.json # Exported OpenAPI 3.1 specification (35 endpoints)
β βββ chainlink_feeds.json # Verified Chainlink Oracle Registry (Multi-Chain)
β βββ contracts.arbitrum.json # Deployed addresses on Arbitrum One
β βββ contracts.fisco.json # Deployed addresses on FISCO BCOS (Chain ID 20200)
β βββ contracts.sepolia.json # Deployed addresses on Ethereum Sepolia
β βββ defi_protocols.json # Verified DeFi Protocol Registry & Function Selectors
βββ LICENSE # MIT License
βββ README.md # Root repository guide (this file)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Tec-C On-Chain Vault Model β
β β
β βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
β β Passkey Root Owner β β AI Brain (Session Key) β β
β β (Biometric Face ID) β β (LangGraph Cognitive Planner) β β
β βββββββββββββββ¬ββββββββββββββ ββββββββββββββββββ¬βββββββββββββββββ β
β β β β
β β (Root Signer) β (Session Signer) β
β βΌ βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SessionKeyValidator (ERC-7579) β β
β β - Validates EIP-712 UserMandate commitments β β
β β - Verifies 117-byte ECDSA session signatures via ERC-1271 β β
β β - Enforces validity time bounds & mandate policy merkle root β β
β ββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β TecAccount (ERC-7579 Core) β β
β β - Modular ERC-4337 Smart Account with pre/post execution hooks β β
β β - Zero funds movable without active TetherGuardHook authorization β β
β ββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β TetherGuardHook (ERC-7579 Hook) β β
β β - Dual-Axis Spending Limit: Meters daily cumulative spend in USD β β
β β - Dynamic Elasticity: Ratified safe transactions expand radius by 10% β β
β β - Breaking the Tether: Biometric FaceID required to exceed radius β β
β β - Whitelist & Risk Tier Enforcement (Tier 1 Core, Tier 2 Growth) β β
β β - Deadman Switch & AI Heartbeat Watchdog (<48h ping required) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Tsinghua Academic Foundation (Prof. Dacheng Xiu & Prof. Wolfgang HΓ€rdle): LLMs and sentiment models can hallucinate, lag, or time out during high-volatility flash crashes.
-
Strict Invariant Enforcement:
- The AI Brain can only strictly tighten constraints (
$B_{AI} \le B_{math}$ ), never loosen them. - The AI can veto a candidate, reduce allocation size, or require biometric verification.
- The AI can never override a quantitative Layer 1β5 rejection or expand authorization.
- If the AI model times out (
$> 8.0\text{s}$ ) or errors, the order goes onHOLD: nothing runs automatically and every option stays available for manual approval. An invalid model verdict is discarded and the deterministic rules decide.
- The AI Brain can only strictly tighten constraints (
-
WeBank Consortium Chain Alignment & Banking Secrecy:
Instead of leaking proprietary econometric orderbook curves or client trade details in plaintext on-chain, Tec-C commits cryptographic SHA-256 commitments to FISCO BCOS:
$$\text{RecordHash} = \text{SHA256}\Big(\text{account} ;\parallel; \text{symbol} ;\parallel; \text{action} ;\parallel; P_{\text{cons}} ;\parallel; \text{timestamp} ;\parallel; \text{salt}\Big)$$ - Emits an
AuditRecordAnchoredevent on the consortium chain, allowing instant regulatory verification (PBOC/CSRC/WeBank) while preserving complete commercial privacy at $0.00 gas fee.
-
Flash Panic Orderbook Thinning Defense:
When sudden volatility causes a DEX execution to revert with
SLIPPAGE_EXCEEDED, Tec-C automatically cuts order size in half ($Q^*/2$ ). -
Positive Expected Carry Invariant:
Before resubmitting, verifies that expected carry value remains strictly positive (
$E[\Delta V] > 0$ ). Submits the halved recovery order once, preventing infinite retry loops and gas draining.
- 100% Operable Without Paid Subscriptions: Integrates Chainlink decentralized oracles, DeFiLlama REST, Binance public tickers, and Alternative.me sentiment without requiring any paid API key.
- Enterprise Comparative Catalog: Documents $100k+/year institutional feeds (Bloomberg, Kaiko, Amberdata, CoinAPI, Nansen) and maps each to a zero-cost open alternative.
Ran 14 test suites: 170 tests passed, 0 failed, 0 skipped (170 total tests)-
PrivacyAuditAnchorTest: 3 passed (Cryptographic digest anchoring, zero-hash rejection, replay defense) -
WebAuthnP256ValidatorTest: 15 passed (RIP-7212 precompile0x100, pure-Solidity fallback, low-$s$, UV & recovery) -
TetherGuardHookTest: 37 passed (Velocity limits, dynamic elasticity, biometric breakout, morning review) -
TecPaymasterTest: 6 passed (Gas sponsorship & anti-griefing limits) -
CrossChainTetherTest: 7 passed (Multi-chain aggregate lock & par-repo facility) -
DeadmanAndHeartbeatTest: 10 passed (AI heartbeat watchdog & 90-day deadman switch) -
VaultComprehensiveFuzzTest: 5 passed (256 fuzz runs each) -
VaultSecurityHardeningTest: 18 passed (SEC-01..08 security regression invariants) -
VaultEdgeCasesTest: 19 passed (Zero-value & boundary conditions) -
VaultLifecycleScenariosTest: 4 passed (Multi-day enterprise lifecycles) -
SessionKeyValidatorTest: 8 passed (EIP-712 AI mandate verification) -
VaultGasBenchmarkTest: 19 passed (Multi-chain empirical gas matrix) -
MultiTokenTetherTest: 12 passed (Multi-token pricing & USD normalization) -
TecAccountTest: 7 passed (ERC-7579 modular account execution)
1663 collected: 1632 passed, 31 not passing # the 31 are on-chain integration tests that deploy a fresh vault; they fail until the TetherGuardHook # constructor call in onchain/deploy.py is fixed (see Known Limitations in the Security Self-Assessment)
-
test_audit_resolution.py: 22 passed (System Flow Audit regressions: AI veto/BREAKOUT binding at execute, PegGuard through the Brain, HOLD on model failure, market routing, anchoring, masked notes, live phone gateway) -
test_strictness_hierarchy.py: 9 passed (Asymmetric bounding$B_{AI} \subseteq B_{math}$ , deterministic Layer 1-5 gating, fail-closed timeout > 8.0s, audit anchor hashing) -
test_fisco_node.py: 8 passed (Automated cluster supervisor, health probing, WSL idle timeout management, clean shutdown) -
test_slippage_recovery.py: 4 passed (Slippage detection, order halving$Q^*/2$ , positive carry verification, loop prevention) -
test_audit_anchor.py: 2 passed (Deterministic SHA-256 record hashing, on-chain anchor submission & verification) -
test_market_live_feeds.py: 3 passed (Live feeds catalog, free vs paid mapping, offline fallback) -
test_virtual_session.py: 10 passed (Cloudflare Quick-Tunnel, WebAuthn pairing, step-up tokens, route isolation) -
test_pegguard.py: 20 passed (5-layer arbitrage engine, 25-asset catalog, watermark memory) -
test_biometrics.py: 15 passed (NIST P-256 signing, low-$s$ normalization, UP/UV authenticatorData parser, guardian recovery) -
test_pipeline.py,test_brain.py,test_planner.py: Cognitive intent parser, firewall sieve, and risk engine -
test_coverage_core.py: 660 passed (all 243 possible risk-quiz answer sets, 8-decimal on-chain USD, reference data, cross-chain tether tracker, P-256 passkey signing/verification, WebAuthn helpers, all 25 PegGuard assets) -
test_coverage_intent.py: 225 passed (rules parser actions/assets/amounts/horizons/constraints, firewall on everyday requests and named attacks in English and Chinese, privacy sieve round-trips) -
test_coverage_api.py: 77 passed (catalog, profile and onboarding, regime radar, headline sandbox, backtests, draft β confirm β propose, structured options for every venue, PegGuard and settings endpoints)
cd contracts forge test
cd contracts
forge build --sizesPut your API keys in agent/.env (template: agent/.env.example), then:
powershell -ExecutionPolicy Bypass -File .\dev_up.ps1 # Windows (stop: .\dev_down.ps1)
./dev_up.sh # macOS / Linux (stop: ./dev_down.sh)Dashboard: http://localhost:5500/app.html (also served by the Brain at http://127.0.0.1:8000/app.html).
cd agent .\.venv\Scripts\pytest
cd agent .\.venv\Scripts\python -m tecc_brain.virtual_session.runner
Open PowerShell in the project root directory and run dev_up.ps1:
powershell -ExecutionPolicy Bypass -File .\dev_up.ps1
What this does automatically:
- Starts the local blockchain (Anvil) and deploys/boots up all 3 smart contract wallets (Crypto on Ethereum, Commodities on Arbitrum, Chinese Market on FISCO BCOS) with active session keys and test funds.
- Starts the Backend Brain API on http://127.0.0.1:8000 and the Virtual Session Phone Gateway on port
8001. - Enables the PegGuard Arbitrage 24/7 background scanner with live telemetry across all 25 pegged assets.
- Starts the Frontend Server on http://localhost:5500 and opens it in your default browser.
Run dev_down.ps1:
powershell -ExecutionPolicy Bypass -File .\dev_down.ps1
(This cleanly terminates all background processes on ports 8545, 8000, 8001, and 5500).
This project is licensed under the MIT License.