Skip to content

Measurement System Overview

O edited this page Oct 8, 2025 · 4 revisions

How Measurement Validation Works in O Blockchain

πŸ” Complete Validation Workflow

The O Blockchain uses a multi-layered validation system to ensure data accuracy and prevent fraud. Here's the complete process from invitation to reward.


πŸ“¬ Step 1: Invitation

Invite Creation:

System β†’ Selects qualified user β†’ Creates invite
Invite contains:
  - invite_id (unique, cryptographically secure)
  - invited_user (CPubKey of specific user)
  - type (WATER_PRICE or EXCHANGE_RATE)
  - currency_code (e.g., "USD", "EUR")
  - expiration (14 days from creation)

User Receives:

"You've been invited to measure WATER_PRICE for USD"

You can choose:
  Option 1: Online measurement (10.00 O reward)
  Option 2: Offline measurement (100.00 O reward)

User Decision: At this point, the user decides whether to submit online or offline measurement.


πŸ“Š Step 2: Measurement Submission

Option A: ONLINE Measurement

User submits:
  - measurement_id (unique)
  - submitter (their public key)
  - currency_code ("USD")
  - price (100 cents)
  - volume (33.8)
  - volume_unit ("fl oz")
  - source_url ("walmart.com/water-bottles")
  - source: USER_ONLINE
  - invite_id (from invitation)

Option B: OFFLINE Measurement

User submits:
  - measurement_id (unique)
  - submitter (their public key)
  - currency_code ("USD")
  - price (100 cents)
  - volume (33.8)
  - volume_unit ("fl oz")
  - location ("40.7128Β°N, 74.0060Β°W")
  - proof_image_hash ("QmXxxx...") // IPFS hash
  - source: USER_OFFLINE
  - invite_id (from invitation)

βœ… Step 3: Automated Validation (Immediate)

When a measurement is submitted, the system automatically validates it:

3.1 Security Checks:

1. Invite ID exists? βœ…
2. Invite not expired? βœ…
3. Invite not already used? βœ…
4. Submitter matches invited user? βœ… (CRITICAL SECURITY CHECK)

3.2 Volume Validation:

5. Volume unit valid? (e.g., "L", "fl oz") βœ…
6. Volume in acceptable range?
   - Metric: 0.9L - 1.1L βœ…
   - Imperial: 30 fl oz - 37 fl oz βœ…
7. Price positive? βœ…
8. Calculate price per liter (pro-rated) βœ…
9. Price per liter reasonable? (1 cent - 10M cents) βœ…

3.3 Source-Specific Validation:

For ONLINE (USER_ONLINE or BOT_ONLINE):

10. URL provided? βœ…
11. URL format valid? βœ…
12. URL accessible? βœ…

For OFFLINE (USER_OFFLINE or BOT_OFFLINE):

10. Photo hash provided? βœ…
11. Location provided? βœ…
12. Location format valid? (GPS coordinates) βœ…
13. Timestamp within 60 minutes? βœ… (photo must be recent)

3.4 Gaussian Range Validation:

14. Get recent measurements for same currency
15. Calculate mean and standard deviation
16. Check if new value is within acceptable range (Β±3Οƒ)
17. Record deviation for confidence scoring

Result:

If ALL checks pass β†’ Measurement accepted for human validation
If ANY check fails β†’ Measurement REJECTED immediately

πŸ‘₯ Step 4: Human Validation (Peer Review)

After automated validation, the measurement needs human validators to confirm accuracy.

4.1 Validation Invitation:

System β†’ Selects random validators β†’ Sends validation invites
Invite contains:
  - measurement_id (to validate)
  - type (ONLINE_VALIDATION or OFFLINE_VALIDATION)
  - reward amount (10.00 O or 80.00 O)

4.2 Online Validation (10.00 O Reward):

Validator's Task:

1. Visit the URL provided
2. Verify water price on website
3. Verify volume/container size
4. Verify unit matches
5. Confirm price matches
6. Submit validation: APPROVED or REJECTED

What Validator Checks:

βœ… URL actually shows water for sale
βœ… Price matches what submitter claimed
βœ… Volume matches (e.g., 1.0L, 33.8 fl oz)
βœ… Unit is correct
βœ… Currency is correct

4.3 Offline Validation (80.00 O Reward):

Validator's Task:

1. Review photo provided (IPFS hash)
2. Physically travel to location (if possible)
3. Verify photo is real and recent
4. Confirm price tag visible in photo
5. Confirm volume label visible
6. Confirm unit visible
7. Submit validation: APPROVED or REJECTED

What Validator Checks:

βœ… Photo is authentic (not stock image or photoshopped)
βœ… Price tag clearly visible
βœ… Volume clearly visible on label (e.g., "33.8 FL OZ")
βœ… Unit clearly visible
βœ… Photo appears recent (not old/faded)
βœ… Location plausible (optional: physically verify)

4.4 Validation Threshold:

Minimum validators required: 3 (Config::MIN_VALIDATORS_REQUIRED)

Example progression:
  0 validators: Not validated (0% confidence)
  1 validator:  Not validated (10% confidence)
  2 validators: Not validated (20% confidence)
  3 validators: VALIDATED βœ… (30% confidence)
  5 validators: VALIDATED βœ… (50% confidence)
  10+ validators: VALIDATED βœ… (100% confidence)

4.5 Consensus:

if (validators.size() >= MIN_VALIDATORS_REQUIRED) {
    measurement.is_validated = true;
    measurement.confidence_score = min(1.0, validators.size() / 10.0);
}

πŸ’° Step 5: Reward Distribution

Once a measurement is validated, rewards are created during block mining.

Measurement Submitter Reward:

Online measurement: 10.00 O (quick, convenient)
Offline measurement: 100.00 O (requires travel, more effort)

Validator Rewards:

Online validation: 10.00 O per validator (remote check)
Offline validation: 80.00 O per validator (requires verification effort)

Total Rewards Example:

Scenario: Offline water price measurement with 3 validators

Submitter (offline): 100.00 O
Validator 1 (offline): 80.00 O
Validator 2 (offline): 80.00 O
Validator 3 (offline): 80.00 O
─────────────────────────────
Total: 340.00 O created

All coins created during block mining (no pre-existing funds)

πŸ”„ Complete Flow Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 1: INVITATION                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ System β†’ Selects User β†’ Sends Invite                       β”‚
β”‚ Invite: "Measure WATER_PRICE for USD"                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 2: USER CHOOSES METHOD                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Option 1: Online (10.00 O)  β”‚  Option 2: Offline (100.00 O)β”‚
β”‚ - Find URL                   β”‚  - Go to store              β”‚
β”‚ - Note price + volume        β”‚  - Take photo               β”‚
β”‚ - Submit URL                 β”‚  - Get GPS location         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 3: AUTOMATED VALIDATION (Immediate)                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ βœ… Security: Submitter matches invite?                      β”‚
β”‚ βœ… Volume: In range (0.9-1.1L or 30-37 fl oz)?             β”‚
β”‚ βœ… Unit: Valid ("L", "fl oz", etc.)?                        β”‚
β”‚ βœ… Price: Positive and reasonable?                          β”‚
β”‚ βœ… Gaussian: Within statistical range?                      β”‚
β”‚ βœ… Source: URL accessible OR photo + location valid?        β”‚
β”‚ βœ… Timestamp: Within 60 min (offline only)?                 β”‚
β”‚                                                             β”‚
β”‚ Result: PASS β†’ Continue | FAIL β†’ Reject Immediately        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 4: HUMAN VALIDATION (Peer Review)                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ System β†’ Selects 3+ Validators β†’ Sends Validation Invites  β”‚
β”‚                                                             β”‚
β”‚ ONLINE Validator (10.00 O):        OFFLINE Validator (80.00 O):β”‚
β”‚ - Visits URL                       - Reviews photo          β”‚
β”‚ - Confirms price                   - Confirms authenticity  β”‚
β”‚ - Confirms volume/unit             - Confirms price visible β”‚
β”‚ - Submits: APPROVED βœ…             - Confirms volume visibleβ”‚
β”‚                                    - (Optional: visits location)β”‚
β”‚                                    - Submits: APPROVED βœ…   β”‚
β”‚                                                             β”‚
β”‚ Threshold: 3 validators required β†’ Measurement VALIDATED    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 5: REWARD DISTRIBUTION (Block Mining)                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Block is mined β†’ Coinbase transaction created:             β”‚
β”‚                                                             β”‚
β”‚ [Mining Reward: 50.00 O]                                   β”‚
β”‚ [Measurement Reward: 100.00 O β†’ Submitter]                 β”‚
β”‚ [Validation Reward 1: 80.00 O β†’ Validator 1]               β”‚
β”‚ [Validation Reward 2: 80.00 O β†’ Validator 2]               β”‚
β”‚ [Validation Reward 3: 80.00 O β†’ Validator 3]               β”‚
β”‚ [Stabilization Coins: Variable β†’ Stable currency users]    β”‚
β”‚                                                             β”‚
β”‚ Total new coins: 390.00 O + mining + stabilization         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STEP 6: DATA USAGE                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Validated measurement β†’ Added to daily average calculation  β”‚
β”‚ Daily average β†’ Used for stability monitoring               β”‚
β”‚ Stability status β†’ Triggers stabilization mining if needed  β”‚
β”‚ Exchange rates β†’ Used for currency exchange transactions    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›‘οΈ Multi-Layer Security

Layer 1: Cryptographic Security

  • βœ… Invite ID tied to specific user (CPubKey)
  • βœ… Submitter must match invited user
  • βœ… Cannot steal or trade invites

Layer 2: Automated Validation

  • βœ… Volume range validation
  • βœ… Gaussian range validation (statistical outlier detection)
  • βœ… Timestamp validation (offline: must be within 60 min)
  • βœ… URL accessibility validation (online)
  • βœ… Location format validation (offline)

Layer 3: Human Validation

  • βœ… Peer review by 3+ independent validators
  • βœ… Validators check actual source (URL or photo)
  • βœ… Confirms volume, unit, price accuracy
  • βœ… Prevents fraud and errors

Layer 4: Reputation System

  • βœ… Validators with higher reputation count more
  • βœ… Bad validators lose reputation
  • βœ… Consistently accurate validators gain reputation

πŸ“Š Validation Requirements by Type

ONLINE Measurements:

Submitter Provides:

βœ… URL (e.g., "walmart.com/water-bottles")
βœ… Price (e.g., 100 cents)
βœ… Volume (e.g., 33.8)
βœ… Unit (e.g., "fl oz")
βœ… Currency code (e.g., "USD")

Validators Check:

1. Visit URL
2. Confirm water product exists
3. Confirm price matches
4. Confirm volume/unit matches
5. Vote: APPROVED or REJECTED

Automated Checks:

βœ… URL accessible?
βœ… URL format valid?
βœ… Price in Gaussian range?
βœ… Volume in acceptable range (0.9L-1.1L)?

OFFLINE Measurements:

Submitter Provides:

βœ… Photo (IPFS hash, e.g., "QmXxxx...")
βœ… GPS Location (e.g., "40.7128Β°N, 74.0060Β°W")
βœ… Price (e.g., 100 cents)
βœ… Volume (e.g., 33.8)
βœ… Unit (e.g., "fl oz")
βœ… Currency code (e.g., "USD")

Validators Check:

1. Review photo
2. Confirm photo shows water bottle
3. Confirm price tag visible
4. Confirm volume label visible (e.g., "33.8 FL OZ")
5. Confirm unit visible
6. Confirm photo appears recent/authentic
7. (Optional) Physically visit location to verify
8. Vote: APPROVED or REJECTED

Automated Checks:

βœ… Photo hash provided?
βœ… Location format valid?
βœ… Timestamp within 60 minutes?
βœ… Price in Gaussian range?
βœ… Volume in acceptable range (0.9L-1.1L)?

🎯 Validation States

Measurement Lifecycle:

1. SUBMITTED β†’ measurement received, automated validation pending
2. AUTO_VALIDATED β†’ passed automated checks, needs human validators
3. PENDING_VALIDATION β†’ waiting for 3 validators
4. PARTIALLY_VALIDATED β†’ has 1-2 validators (not enough)
5. VALIDATED β†’ has 3+ validators, accepted into system βœ…
6. REJECTED β†’ failed validation (automated or human)

Confidence Scoring:

confidence_score = min(1.0, validators.size() / 10.0)

Examples:
  3 validators  = 30% confidence (minimum to be validated)
  5 validators  = 50% confidence
  7 validators  = 70% confidence
  10 validators = 100% confidence (maximum)

πŸ’° Reward Schedule

For Submitters:

Measurement Type Reward Effort Level
Water Price (Online) 10.00 O Low - just find URL
Water Price (Offline) 100.00 O High - store visit + photo
Exchange Rate (Online) 10.00 O Low - find URL
Exchange Rate (Offline) 100.00 O High - store visit + photo
URL Submission 20.00 O Medium - find reliable source

For Validators:

Validation Type Reward Effort Level
Online Validation 10.00 O Low - check website
Offline Validation 80.00 O High - review photo/visit location

Why Different Rewards?

  • Offline requires physical travel (time, gas, effort)
  • Offline provides higher quality data (harder to fake)
  • Online is convenient but easier to manipulate
  • Validators doing offline checks earn more (verification effort)

πŸ”’ Fraud Prevention

Attack: Fake URL Submission

Attacker: Submits fake walmart.com URL with wrong price
Automated: URL accessible βœ… (real site)
Validators: Visit URL β†’ Price doesn't match β†’ REJECT ❌
Result: Measurement rejected, attacker gets nothing

Attack: Photoshopped Image

Attacker: Submits edited photo with fake price
Automated: Photo hash valid βœ…, location valid βœ…
Validators: Review photo β†’ Detect editing artifacts β†’ REJECT ❌
Result: Measurement rejected, attacker reputation drops

Attack: Old Photo Reuse

Attacker: Submits 2-week old photo
Automated: Timestamp check β†’ More than 60 min old β†’ REJECT ❌
Result: Measurement rejected immediately

Attack: Invite ID Theft

Attacker: Steals someone's invite ID
Automated: Submitter != Invited User β†’ REJECT ❌
Result: Security violation logged, measurement rejected

Attack: Extreme Outlier

Attacker: Submits $100/L for water (normal is $1/L)
Automated: Gaussian check β†’ 50Οƒ deviation β†’ REJECT ❌
Result: Measurement rejected as statistical outlier

πŸ“ˆ Data Quality Assurance

Statistical Validation:

Every measurement is checked against:
  - Mean of recent measurements
  - Standard deviation
  - Acceptable range (Β±3Οƒ typically)
  - Historical patterns

Cross-Validation:

Multiple validators must agree:
  - Prevents single validator fraud
  - Requires consensus
  - Higher confidence with more validators

Source Diversity:

Data comes from:
  - User online measurements
  - User offline measurements
  - Automated bot scraping
  - Validated URL library
  
Multiple sources β†’ Higher reliability

🎯 Summary

Validation is Multi-Layered:

  1. βœ… Cryptographic - Invite tied to user
  2. βœ… Automated - Volume, range, timestamp, URL/location checks
  3. βœ… Human - 3+ peer validators confirm accuracy
  4. βœ… Statistical - Gaussian range prevents outliers
  5. βœ… Consensus - Multiple validators must agree

Measurements are Invite-Only:

  • Blockchain selects users - Users cannot submit measurements without invitation
  • One invite per user - Blockchain picks specific user for specific measurement
  • User chooses method - Once invited, user decides online or offline submission
  • Reward adjusts - Based on method chosen (online: 10 O, offline: 100 O)
  • No open submission - Cannot measure water prices without being invited by the system

Security is Robust:

  • Cannot steal invites (cryptographic binding)
  • Cannot submit fake data (validators check)
  • Cannot reuse old photos (timestamp check)
  • Cannot submit outliers (Gaussian check)

Rewards are Fair:

  • Higher effort = Higher reward
  • Validators compensated appropriately
  • All rewards created during mining
  • Transparent and predictable

The O Blockchain validation system ensures accurate, fraud-resistant water price data for the stablecoin mechanism! πŸ’§βœ…

Clone this wiki locally