Protocol Smart Contract
Go To:

Trend

OLS regression and volatility analysis0x00000000000000000000000000000000000000DC~20/byte gas

Select a real-world dataset to analyze its trend using on-chain OLS regression.

Bitcoin Price
Bitcoin Price
weekhourly148 pts

BTC/USD hourly prices over 1 week

Mission Impossible: Opening Weekend
Mission Impossible: Opening Weekend
weekendhourly42 pts

Hourly box office revenue patterns Fri-Sun

US Electric Vehicle Sales
US Electric Vehicle Sales
yearmonthly12 pts

Monthly plug-in electric vehicle sales in the US

Global Earthquake Activity
Global Earthquake Activity
day15min96 pts

Cumulative earthquake magnitude per 15-minute interval

Why It Matters

DeFi protocols need deterministic statistical settlement without off-chain trust. Trend enables on-chain price trend analysis, volatility-based triggers, and data-driven smart contracts.

Modes

  • Mode 0x01 (Analysis): Slope percentage, R^2 confidence, volatility
  • Mode 0x02 (Volatility Buckets): Quintile distribution of price velocity

Interface

// Mode 0x01: Full Analysis
Input:  mode(1) | ts1(8) | val1(32) | ts2(8) | val2(32) | ...
Output: slopePct(32) | rSquared(32) | volatility(32) = 96 bytes

// Mode 0x02: Volatility Buckets
Input:  mode(1) | windowSize(8) | ts1(8) | val1(32) | ...
Output: q20(32) | q40(32) | q60(32) | q80(32) = 128 bytes