TheBlocks
Adversarial-Resilient Settlement Protocol
๐น Create Trade / Transfer Rights
Oracle-validated transfers with FIFO ordering | Queue: #0 | Next ID: 1
Transfers (1/100)
โฑ๏ธ Optional Timeout
๐ Trade Summary
Please connect your wallet to create a trade
Hackathon Requirements
All 5 requirements implemented and verified
Multi-Oracle
Chainlink + Pyth + API3 + SyncedFeed
Async Settlement
7-State FSM Flow
Partial Finality
Progressive Commitment
Oracle Resistance
Byzantine Median
Attack Model
Flash Loan + MEV Defense
Unreliable Oracle Defense
Your protocol's oracle may behave adversarially
1. Incorrect Values
Oracle reports 30% off
2. Outdated Data
Oracle provides stale prices
3. Missed Updates
Oracle fails to update
4. Conflicting Values
Multiple oracles disagree
All 4 Adversarial Conditions Defended
Multi-oracle BFT aggregation: Byzantine Median + Staleness Checks + Fail Tracking + Confidence Weighting
๐งช Run Attack SimulatorHow Our Multi-Oracle BFT System Works
Self-healing architecture that maintains accuracy even with faulty oracles
Filter out outdated oracle data
Detect manipulation attempts
Fault-tolerant price calculation
Weighted average by reliability
Handling Faulty API3 Oracle (Hackathon Condition)
The hackathon requires our system to work even when API3 returns stale/incorrect data. Here's how we handle it:
Detection
API3 data on Sepolia is stale (updatedAt > 24h ago). Our staleness check automatically detects this.
if (age > MAX_STALENESS) โ excludeFallback
When API3 is excluded, SyncedPriceFeed activates as replacement - it derives price from Chainlink + Pyth.
SyncedFeed = median(CL, Pyth)Continuity
System continues operating with 4/5 oracles. BFT still maintains correctness with 3+ valid sources.
BFT: โ(n-1)/3โ = 1 fault tolerated๐ Settlement Transaction Flow
Create
User submits settlement with transfers
Queue
FIFO ordering prevents MEV
Deposit
Funds locked in escrow
Execute
Oracle-validated transfer
Built for TriHacker Tournament 2025 | Scaffold-ETH 2 โข Solidity โข Next.js