A robust and secure decentralized oracle system built on the Stacks blockchain using Clarity smart contracts. DORS provides reliable price feed data through a sophisticated stake-weighted consensus mechanism with multiple data source integration.
DORS solves the oracle problem in blockchain networks by implementing a redundant, stake-weighted system where multiple oracle nodes provide and verify data. The system ensures high reliability through economic incentives, round-based consensus mechanisms, and performance tracking.
-
Advanced Stake-Based Participation:
- Minimum stake requirement: 1,000,000 microSTX
- Stake-weighted voting power
- Dynamic performance scoring
-
Round-Based Consensus:
- Time-windowed submission periods
- Stake-weighted price aggregation
- Outlier detection and filtering
-
Performance Tracking:
- Accuracy scoring system
- Historical performance metrics
- Weighted reputation scores
-
Economic Incentives:
- Rewards for accurate submissions
- Penalties for deviation
- Stake-based influence
The system consists of three main data structures:
;; Oracle Node Data
(define-map oracle-nodes
principal
{
stake: uint,
active: bool,
accuracy-score: uint,
total-submissions: uint,
total-correct: uint,
weighted-score: uint,
last-submission-height: uint
}
)
;; Price Round Data
(define-map price-rounds
uint
{
final-price: (optional uint),
submissions-count: uint,
consensus-reached: bool,
round-closed: bool,
total-stake-weight: uint
}
)
;; Round Submissions
(define-map round-submissions
{round-id: uint, oracle: principal}
{
price: uint,
stake-weight: uint,
verified: bool,
rewarded: bool
}
)
-
Oracle Registration and Management
register-oracle
: Register as an oracle node with required stakecalculate-stake-weight
: Compute node's influence based on stake and performance
-
Price Submission System
submit-price-with-weight
: Submit price data with stake-weighted influencefinalize-round
: Process submissions and determine consensus price
-
Consensus Mechanism
- Round-based submission windows
- Stake-weighted median calculation
- Automatic round progression
-
Performance Tracking
- Accuracy score calculation
- Historical performance metrics
- Dynamic stake weight adjustments
- Stacks blockchain environment (testnet or mainnet)
- Clarity CLI tools
- Minimum stake amount in STX
- Node.js and npm (for testing environment)
- Clone the repository:
git clone https://github.com/your-username/dors.git
cd dors
- Install dependencies:
npm install
- Deploy the contract:
clarinet contract deploy oracle-system
To register as an oracle:
(contract-call? .oracle-system register-oracle)
To submit price data:
(contract-call? .oracle-system submit-price-with-weight u1000000)
To check round status:
(contract-call? .oracle-system get-round-status u1)
Run the test suite:
clarinet test
- Minimum stake requirement prevents spam
- Time-windowed submissions prevent manipulation
- Stake-weighted consensus reduces attack vectors
- Performance tracking identifies malicious actors
- Economic penalties for bad behavior
- Basic oracle registration
- Simple price submission
- Administrative controls
- Enhanced consensus mechanism
- Stake-weighted reporting
- Round-based submissions
- Performance tracking
- Economic incentives
- Multiple data source integration
- Advanced verification methods
- Cross-chain compatibility
- Governance mechanisms
- Advanced economic models
- Fork the repository
- Create your feature branch:
git checkout -b feature/AmazingFeature
- Commit your changes:
git commit -m 'Add some AmazingFeature'
- Push to the branch:
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow Clarity best practices
- Include comprehensive tests
- Update documentation
- Follow the existing code style
- Add inline comments for complex logic
This project is licensed under the MIT License.
- Stacks Foundation
- Clarity Lang Documentation
- Bitcoin Network
- Blockchain Oracle Community
- Added round-based consensus mechanism
- Implemented stake-weighted reporting
- Enhanced performance tracking
- Added economic incentives
- Initial release
- Basic oracle functionality
- Simple price submissions