CHANCEDB API

Read market data

Query published market distributions, probabilities, outcomes, and forecast scores. These GET methods read Base and return JSON with block provenance; they do not submit transactions or store market state.

GET/api/quantile

Get a quantile

Return the market outcome at probability p. For example, the median uses p=0.5.

market Market contract address.p Probability strictly between 0 and 1.view Optional: current, crowd, or a report ID.
Response
Run the example to see the live response.

The response includes quantile, the selected view, decimal coefficients, blockNumber, and blockTimestamp.

GET/api/probability

Get probability and density

For an outcome threshold x, return the cumulative probability, exceedance probability, and probability density.

market Market contract address.x Outcome threshold in the market’s fractional units.view Optional: current, crowd, or a report ID.
Response
Run the example to see the live response.

cdf is P(X ≤ x), exceedance is P(X > x), and pdf is the density at x.

GET/api/outcome

Read the resolved outcome

Return the outcome published to the market contract and the evaluation target. This endpoint returns HTTP 409 until the market is resolved.

market Market contract address.
Response
Run the example to see the live response.

The response includes outcome, outcomeWad, evaluationTarget, blockNumber, and blockTimestamp.

GET/api/leaderboard

Read the forecast leaderboard

After resolution, rank unchallenged reports by log-density at the realized outcome. The response also includes crowd and current-view benchmarks. Returns HTTP 409 before resolution.

market Market contract address.
Response
Run the example to see the live response.

Each leaderboard entry includes rank, reportId, reporter, and logDensity. Higher log-density ranks better for this realized outcome.

GET/api/read

Read a contract view

Call a supported Solidity view getter at one Base block. This is a read-only wrapper around the market ABI; it cannot call write methods.

market Market contract address.method One of the supported view methods below.id Required only for reportA; report IDs start at zero.
Response
Run the example to see the live response.

The result includes the selected method, raw contract return value, blockNumber, and blockTimestamp. Integer values are decimal strings. reportA returns the named report fields; coefficient arrays remain raw int256 WAD values. Legacy reports return null for fields that version does not store.

SHARED BEHAVIOR

Views, units, and freshness

  • Default view: before resolution, curve methods use current. After resolution, they use crowd, falling back to current when there are no unchallenged reports.
  • Explicit views: current reads currentA(); crowd averages active reports’ coefficients position by position, padding shorter vectors with zero; a numeric view selects that report’s newA. Report IDs start at zero.
  • Units: probabilities are between 0 and 1. Outcomes use fractional market units; for example, 0.01 represents a 1% change.
  • Freshness: curve, outcome, and leaderboard responses include block number and timestamp so callers can verify the chain snapshot.
  • Read-only: all examples call GET endpoints. They do not write to the chain, require a wallet, or persist data.