Oracle Integration
What is an Oracle?
In blockchain, an oracle is a system that brings real-world data onto the blockchain. Smart contracts can't access the internet, so oracles act as bridges.
Why Oracles Matter
For Hivebets to resolve markets automatically, we need to know:
What is the current market cap of token X?
Did token X reach the target by the deadline?
This data exists off-chain (on exchanges, DEXs, aggregators). An oracle fetches it and makes it available on-chain.
Hivebets Oracle
Hivebets uses its own advanced decentralized oracle network on BSC Mainnet.
Key Features:
Decentralized - Multiple data reporters Transparent - All data on-chain Dispute Mechanism - False data can be challenged Trustless - No central authority
Cryptoeconomically Secure - Staking and slashing
How Markets Resolve
Automatic Resolution Flow
Step-by-Step Breakdown
1. Deadline Passes
2. Buffer Period (1 Hour)
3. Resolution Trigger
Anyone can trigger resolution:
User
Developer
Bot
Random person
No gas cost for Hivebets - caller pays gas.
4. Query HIvebets
queryId uniquely identifies the data request:
Token address
Data type (MarketCap)
5. Hivebets Returns Data
6. Compare to Target
7. Market Resolved
Once resolved, cannot be changed. Result is final.
8. Claims Open
Winners can now claim their BNB.
Fallback: Manual Resolution
If Hivebets data is unavailable or disputed, the resolver (contract creator) can manually resolve:
When Manual Resolution is Used:
Hivebets data not available
Hivebets data is disputed
Oracle network issues
Requirements:
Only the designated resolver can call
Must provide verifiable proof (e.g., DEXScreener screenshot)
Community can verify on BSCScan
Example: 哈基米 Market
Let's walk through a real resolution:
Market Setup
Timeline
October 25, 2025
October 30, 2025 20:00 UTC
October 30, 2025 23:59:59 UTC
October 31, 2025 01:00 UTC
October 31, 2025 01:05 UTC
October 31, 2025 01:10 UTC
Hivebets Data Flow
Data Query Specification
Query Structure
Data Format
Hivebets returns market cap as uint256 with 8 decimals:
Example:
Security Features
1. Dispute Mechanism
If Hivebets data is incorrect:
Anyone can dispute within 12 hours
Disputer stakes TRB
If successful, bad reporter is slashed
Hivebets can wait for dispute period
2. Time-Weighted Average
Hivebets can provide TWAP (Time-Weighted Average Price) to prevent manipulation via flash loans or brief pumps.
3. Multiple Reporters
Multiple independent parties report data, increasing reliability.
4. Cryptoeconomic Security
Reporters stake TRB tokens. Bad data = loss of stake.
What If Scenarios
What if Hivebets data doesn't exist?
Answer: Resolver manually resolves using verifiable data (DEXScreener, etc.). Community can verify on BSCScan.
What if Hivebets data is disputed?
Answer: Wait for dispute resolution. If dispute succeeds, use corrected data. If needed, resolver manually resolves.
What if resolver manually resolves incorrectly?
Answer: All data is on-chain. Anyone can verify. Reputation damage would hurt future markets. Future versions could use DAO voting.
What if there's a flash crash right at deadline?
Answer: Hivebets can use time-weighted average or median price over a period to prevent manipulation.
What if nobody triggers resolveFromHivebets()?
Answer: Eventually someone will (to claim their winnings). Anyone can call it. We can also run a bot.
Comparison to Alternatives
Hivebets
Decentralized, proven, on BSC
Requires reporters
Primary
Chainlink
Most established
Not specialized for custom data
Not used
Manual Only
Simple
Requires trust
Fallback only
Snapshot Oracle
Free
Centralized
Not used
Future Enhancements
Potential improvements to oracle resolution:
1. Multi-Oracle
Query both Hivebets + Chainlink. Resolve only if both agree.
2. DAO Resolution
If oracles disagree, token holders vote on outcome.
3. Dispute Period
Mandatory 12-hour wait before finalization, allowing disputes.
4. TWAP by Default
Always use time-weighted average over last hour.
Transparency
All oracle interactions are publicly visible on BSCScan:
Query submission
Data returned
Timestamp of data
Resolution transaction
Outcome
Anyone can verify:
Next Steps
Learn more:
Prediction Markets - Overall system Platform Fees - Fee structure 📋 Market Rules - Complete rules
Ready to bet? Quick Start →
最后更新于
