-
Notifications
You must be signed in to change notification settings - Fork 0
Volume Validation System
The O Blockchain stablecoin is calibrated to water prices at 1 liter = 1 O coin. However, water is sold in various container sizes and measurement systems worldwide. This system ensures all measurements are accurately converted to price per liter while accepting common container sizes.
- Minimum: 0.9 liters (900 mL)
- Maximum: 1.1 liters (1,100 mL)
- Target: 1.0 liter (1,000 mL)
- Common Sizes: 1L, 1000mL, 950mL, 1050mL bottles
- Minimum: 30 fl oz (~0.887 liters)
- Maximum: 37 fl oz (~1.094 liters)
- Target: 33.814 fl oz (~1.0 liter)
- Common Sizes: 33.8 fl oz (1L equivalent in USA)
- Β±10% tolerance around 1 liter accommodates common bottle sizes
- Prevents gaming (can't submit tiny/huge containers for manipulation)
- Matches real market (most water bottles are close to 1 liter)
- International compatibility (works for both metric and imperial)
When a container is not exactly 1 liter, the system automatically pro-rates the price:
Price per Liter = (Container Price) / (Container Volume in Liters)
Example 1: Metric System
Container: 950mL water bottle costs $1.14 (114 cents)
Conversion: 950mL = 0.95L
Pro-rated: $1.14 / 0.95L = $1.20 per liter (120 cents/L)
Example 2: Imperial System (USA)
Container: 33.8 fl oz water bottle costs $1.00 (100 cents)
Conversion: 33.8 fl oz = 0.9996L β 1.0L
Pro-rated: $1.00 / 1.0L = $1.00 per liter (100 cents/L)
Example 3: Larger Container
Container: 1.1L water bottle costs $1.32 (132 cents)
Conversion: 1.1L (already in liters)
Pro-rated: $1.32 / 1.1L = $1.20 per liter (120 cents/L)
| Unit | Abbreviations | Conversion to Liters |
|---|---|---|
| Liters | L, liter, liters, litre, litres | 1.0 |
| Milliliters | mL, milliliter, milliliters | Γ· 1000 |
| Unit | Abbreviations | Conversion to Liters |
|---|---|---|
| Fluid Ounces | oz, fl oz, floz, fluid ounce | Γ· 33.814 |
| US Gallons | gal, gallon, us gal | Γ 3.78541 |
| UK Gallons | uk gal, imperial gallon | Γ 4.54609 |
| Pints | pt, pint, pints | Γ 0.473176 |
| Quarts | qt, quart, quarts | Γ 0.946353 |
-
USA: Defaults to
fl oz(fluid ounces) -
UK: Defaults to
fl oz(fluid ounces) -
All Other Countries: Defaults to
L(liters)
Input: "33.8 fl oz"
Parse: volume=33.8, unit="fl oz"
Result: VolumeUnit::FLUID_OUNCES
Convert to liters: 33.8 fl oz = 0.9996L
Check range: 0.9L β€ 0.9996L β€ 1.1L β
Result: VALID
Container price: 100 cents
Volume: 0.9996L
Price per liter: 100 / 0.9996 = 100.04 cents/L
Result: 100 cents/L (rounded)
Price per liter: 100 cents
Range check: 1 cent/L β€ 100 cents/L β€ 10,000,000 cents/L β
Result: REASONABLE
Container: 500mL (0.5L) costs 50 cents
Volume check: 0.5L < 0.9L β
Result: REJECTED - "Volume out of acceptable range (0.9 - 1.1 L)"
Container: 2.0L costs 200 cents
Volume check: 2.0L > 1.1L β
Result: REJECTED - "Volume out of acceptable range (0.9 - 1.1 L)"
Container: 12 inches costs 100 cents
Unit parse: "inches" β
Result: REJECTED - "Invalid or unsupported volume unit: inches"
Container: 1.0L costs 10,000,000,000 cents
Price check: 10,000,000,000 cents/L > 10,000,000 cents/L β
Result: REJECTED - "Price per liter is unreasonable"
struct WaterPriceMeasurement {
// ... existing fields ...
// NEW FIELDS:
double volume; // Container volume (e.g., 1.0, 0.95, 33.8)
string volume_unit; // Unit (e.g., "L", "mL", "fl oz")
int64_t price_per_liter; // Calculated price per liter (pro-rated)
// ... rest of fields ...
};BEFORE:
- submitter
- currency_code
- price (total container price)
- location or source_url
AFTER (REQUIRED):
- submitter
- currency_code
- price (total container price)
- volume (container size) β NEW
- volume_unit (e.g., "L", "fl oz") β NEW
- location or source_url
When validators check measurements, they must verify:
- β Volume is accurate (matches photo/URL)
- β Unit is correct (metric vs imperial)
- β Price is accurate (matches photo/URL)
- β Container size is within range (0.9L - 1.1L equivalent)
Online Validation:
User submits: $1.20 for 1.0L from walmart.com
Validator checks URL: Confirms 1.0L bottle costs $1.20 β
Result: VALIDATED
Offline Validation:
User submits: Photo of 33.8 fl oz bottle with $1.00 price tag
Validator checks photo:
- Confirms 33.8 fl oz visible on label β
- Confirms $1.00 price tag β
- Confirms contenance (volume) matches label β
Result: VALIDATED
- β All prices standardized to per-liter basis
- β Eliminates confusion from different container sizes
- β Fair comparison across different regions
- β Can submit measurements for any common bottle size
- β Automatic conversion (no manual calculation needed)
- β Clear validation rules
- β Consistent data for stablecoin calibration
- β Prevents manipulation through unusual container sizes
- β Works globally with different measurement systems
- β Clear requirements (volume + unit must match photo/URL)
- β Easy to verify (just check container label)
- β Protected against fraud (volume range limits)
Measurement:
- Container: 33.8 fl oz (1L equivalent)
- Price: $1.50
- Unit: "fl oz"
Processing:
- Convert: 33.8 fl oz = 0.9996L
- Pro-rate: $1.50 / 0.9996L = $1.5006/L
- Store: 150 cents/L
Result: β
Accepted
Measurement:
- Container: 1.0L
- Price: β¬1.20 (120 euro-cents)
- Unit: "L"
Processing:
- Convert: 1.0L (already in liters)
- Pro-rate: 120 cents / 1.0L = 120 cents/L
- Store: 120 cents/L
Result: β
Accepted
Measurement:
- Container: 1000mL
- Price: Β₯110 (110 yen)
- Unit: "mL"
Processing:
- Convert: 1000mL = 1.0L
- Pro-rate: Β₯110 / 1.0L = Β₯110/L
- Store: 110 yen/L
Result: β
Accepted
Measurement:
- Container: 950mL
- Price: A$1.90 (190 cents)
- Unit: "mL"
Processing:
- Convert: 950mL = 0.95L
- Pro-rate: 190 cents / 0.95L = 200 cents/L
- Store: 200 cents/L
Result: β
Accepted (within 0.9L - 1.1L range)
-
src/measurement/volume_conversion.h- Volume unit definitions and conversion logic -
src/measurement/volume_conversion.cpp- Implementation of conversions and validation -
src/measurement/measurement_system.h- Updated WaterPriceMeasurement struct -
src/measurement/measurement_system.cpp- Integration with submission process
// Validate and convert a measurement
VolumeValidationResult ValidateWaterPriceVolume(
double volume,
string unit_str,
int64_t price,
string currency_code
);
// Convert any unit to liters
double VolumeConverter::ToLiters(double volume, VolumeUnit unit);
// Calculate price per liter
int64_t VolumeConverter::CalculatePricePerLiter(
int64_t price_for_volume,
double volume,
VolumeUnit unit
);All water price submissions are automatically validated and converted during the SubmitWaterPrice() function. No manual intervention required.
When you receive a measurement invitation, you have TWO OPTIONS - choose whichever is most convenient:
Option 1: ONLINE Measurement (Lower Reward: 10.00 O)
- Find water price on a website (e.g., walmart.com, amazon.com, local grocery store site)
- Provide: URL + price + volume + unit
- Quick and convenient
Option 2: OFFLINE Measurement (Higher Reward: 100.00 O)
- Take photo of water bottle with price tag in a physical store
- Provide: Photo + GPS location + price + volume + unit
- Requires physical travel but pays more
You decide which method to use based on:
- Your location (near a store vs at home)
- Your time (quick URL vs store visit)
- Your preference (privacy vs convenience)
- Reward difference (10x more for offline)
- Look at the water bottle/container (physical or online)
- Note the volume (e.g., "1L", "33.8 fl oz", "1000mL")
- Note the price
- Note the unit used on the label
- Submit with exact volume and unit from the label
- Check the photo/URL provided
- Verify the volume matches what's shown
- Verify the unit matches the label
- Verify the price matches
- Confirm volume is within acceptable range (0.9L - 1.1L)
- β DO submit the exact container size (not rounded)
- β DO include the unit from the label
- β DO use the price for that specific container
- β DON'T try to manually calculate price per liter
- β DON'T round volumes to "1L" if the label says otherwise
- β DON'T submit containers outside the 0.9L - 1.1L range
The Volume Validation and Unit Conversion System ensures:
- β Accurate water prices calibrated to 1 liter
- β Global compatibility with different measurement systems
- β Fair comparisons across regions and container sizes
- β Fraud prevention through volume range limits
- β User-friendly automatic conversion
The O Blockchain now accurately handles water price measurements from anywhere in the world, regardless of container size or measurement system! π§π
Β© O International
A Nonprofit Association Focused on the Creation of a Water Price-Based Stable Coin
Association de Loi 1901 β France NumΓ©ro de Siret (French SIREN): 924 014 467 00014