Skip to content

Silica-Contracts/oracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PoUW (Proof of Useful Work) Oracle Contract

On-chain smart contract for Silica's Proof of Useful Work system. This contract receives verified work proofs from off-chain oracles and handles submissions, reward payments, dispute resolution, and miner reputation tracking.

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                        Off-Chain Layer                              │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐            │
│  │  BOINC   │  │ Folding  │  │ Einstein │  │  Other   │            │
│  │ Projects │  │  @Home   │  │  @Home   │  │ Compute  │            │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────┘            │
│       │             │             │             │                   │
│       └─────────────┴──────┬──────┴─────────────┘                   │
│                            ▼                                        │
│                    ┌───────────────┐                                │
│                    │  PoUW Oracle  │  (Rust service - see ZZ_chert) │
│                    │   Service     │                                │
│                    └───────┬───────┘                                │
└────────────────────────────┼────────────────────────────────────────┘
                             │ Signed Work Proofs
                             ▼
┌─────────────────────────────────────────────────────────────────────┐
│                        On-Chain Layer                               │
│                    ┌───────────────┐                                │
│                    │  THIS CONTRACT │                               │
│                    │  (PoUW Oracle) │                               │
│                    └───────┬───────┘                                │
│                            │                                        │
│       ┌────────────────────┼────────────────────┐                   │
│       ▼                    ▼                    ▼                   │
│  ┌─────────┐        ┌─────────────┐      ┌─────────────┐           │
│  │ Rewards │        │   Disputes  │      │   Miner     │           │
│  │ Payout  │        │  Resolution │      │  Registry   │           │
│  └─────────┘        └─────────────┘      └─────────────┘           │
└─────────────────────────────────────────────────────────────────────┘

Features

  • Work Submissions - Receive and track verified computational work from BOINC, Folding@Home, etc.
  • Reward Payments - 70% provisional payout, 30% after dispute window
  • Dispute Resolution - Challenge fraudulent submissions with bond
  • Miner Registry - Track reputation, completions, and earnings
  • Oracle Management - Authorized oracles submit verified proofs
  • Multi-Oracle Consensus - High-value rewards require multiple confirmations
  • Rate Limiting - Max 1000 submissions/miner/day
  • Clawback Mechanism - Recover funds from fraudulent submissions

Supported Projects

Project Multiplier Description
WorldCommunityGrid 1.2x Medical & environmental research
Rosetta@Home 1.1x Protein folding research
Einstein@Home 1.1x Gravitational wave detection
Folding@Home 1.0x Disease research
BOINC (generic) 1.0x Other BOINC projects

API Reference

Miner Functions

register_miner()

Register as a PoUW miner with stake.

  • Minimum Stake: 100 CHERT
  • Initial Reputation: 50%

add_miner_stake()

Add additional stake to increase security deposit.

withdraw_miner_stake()

Withdraw stake (only if no pending submissions in dispute window).

Oracle Functions (Authorized Only)

submit_work(miner, work_hash, reward_points)

Submit verified work proof for a miner.

  • Validates miner registration
  • Checks daily submission limit
  • Calculates rewards with project multiplier
  • Sends 70% provisional payout immediately
  • Records submission for dispute window

confirm_submission(submission_id)

Additional oracle confirmation for high-value submissions.

  • Required for rewards ≥ 1000 CHERT
  • Minimum 2 oracle confirmations needed

Payout Functions

finalize_payout(submission_id)

Finalize payout after 24-hour dispute window.

  • Anyone can call (permissionless)
  • Sends remaining 30% to miner
  • Updates miner reputation (+10 points)

Dispute Functions

open_dispute(submission_id)

Challenge a potentially fraudulent submission.

  • Bond Required: 50 CHERT
  • Must be within 24-hour dispute window

resolve_dispute(dispute_id, ruling)

Resolve a dispute (admin/governance only).

  • Fraud: Slash miner stake, reward challenger
  • Valid: Challenger loses bond to treasury
  • Inconclusive: Refund both parties

Query Functions

get_submission_info(submission_id)WorkSubmission

get_miner_info(address)MinerInfo

get_oracle_info(address)OracleInfo

get_project_info(name)ProjectConfig

get_dispute_info(dispute_id)Dispute

get_stats()Stats

can_submit(miner)bool

Admin Functions

register_oracle(address, public_key)

deactivate_oracle(address)

configure_project(name, multiplier, enabled)

set_treasury(address)

set_paused(paused)

Events

PoUWInitialized { admin, dispute_window, min_miner_stake, min_oracle_stake }
MinerRegistered { miner, stake, initial_reputation }
MinerStakeAdded { miner, added, total_stake }
MinerStakeWithdrawn { miner, amount }
OracleRegistered { oracle, initial_reputation }
OracleDeactivated { oracle }
WorkSubmitted { submission_id, miner, oracle, project, reward_points, provisional_paid, dispute_deadline }
SubmissionConfirmed { submission_id, confirming_oracle, total_confirmations }
PayoutFinalized { submission_id, miner, final_amount, total_amount }
DisputeOpened { dispute_id, submission_id, challenger, miner, reason, bond }
DisputeResolved { dispute_id, submission_id, ruling, challenger, miner }
MinerSlashed { miner, slash_amount, challenger_reward }
ProjectConfigured { name, reward_multiplier, enabled }
TreasuryUpdated { treasury }
ContractPaused { paused }

Configuration

Parameter Value Description
MIN_MINER_STAKE 100 CHERT Minimum stake to register as miner
MIN_ORACLE_STAKE 10,000 CHERT Minimum stake for oracle registration
DISPUTE_BOND 50 CHERT Bond required to open dispute
DISPUTE_WINDOW 24 hours Time window for challenging submissions
MAX_DAILY_SUBMISSIONS 1000 Rate limit per miner per day
PROVISIONAL_PAYOUT 70% Immediate payout percentage
FINAL_PAYOUT 30% Payout after dispute window
HIGH_VALUE_THRESHOLD 1000 CHERT Requires multi-oracle confirmation
FRAUD_SLASH 100% Stake slashed on confirmed fraud
CHALLENGER_REWARD 10% Portion of slash given to challenger

Security Model

  1. Economic Security: Miners stake tokens; slashed for fraud
  2. Multi-Oracle: High-value submissions require 2+ oracle confirmations
  3. Dispute Window: 24-hour window to challenge submissions
  4. Rate Limiting: Prevents gaming and DoS attacks
  5. Clawback: Provisional payouts recovered on fraud detection

Building

cargo build --target wasm32-unknown-unknown --release

Testing

cargo test

Related Components

  • Off-Chain Oracle Service: ZZ_chert/oracle/ - Rust service that verifies BOINC work and submits proofs
  • Miner: miner/ - Mining software with BOINC integration
  • Wallet: wallet/ - User interface for PoUW participation

License

MIT OR Apache-2.0

About

Decentralized oracle system for bringing off-chain data on-chain on Silica

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages