Skip to Content
Quickstart

Quickstart

Claros is a verifiable real-world-data oracle on Casper. It works like Pyth: every feed is keyed by a feed_id string, the on-chain value is stored as an integer, and the human number is amount / 10^decimals. The data lives on-chain, you just read it.

This page reads one feed three ways and shows you exactly what comes back. The example is EIA.PET.PRICE.WTI.DAILY, the WTI crude oil daily spot price sourced from the U.S. EIA.

Everything here points at Casper testnet (network id casper-test). The contract addresses are baked into the SDK and REST service, so on-chain reads need no key, no wallet, and no indexer. Reads are free.

Read your first feed

Pick a feed

A feed_id selects one real-world series. The example feed maps to a single faceted EIA query:

fieldvalue
feed_idEIA.PET.PRICE.WTI.DAILY
routepetroleum/pri/spt
frequencydaily
columnvalue
facetseries = RWTC
unit$/bbl
decimals6

There are 38 feeds live on-chain today. You can enumerate every one with the SDK (listFeedIds()) or browse the naming scheme on the Feed IDs page.

Read it

Pick whichever surface fits where your code runs. All three return the same on-chain reading.

Plain HTTP, any language, no key. Run services/claros-api (port 4030) or point at a hosted instance:

curl http://localhost:4030/v1/feeds/EIA.PET.PRICE.WTI.DAILY

The endpoint reads Casper state through the SDK and returns the reading as JSON.

Scale the value

On-chain the value is an integer. Divide by 10^decimals to get the human number:

amount = 78940000 decimals = 6 value = 78940000 / 10^6 = 78.94 ($/bbl)

The REST response and the SDK Reading already compute value for you. On-chain, do the division yourself with the decimals from FeedRegistry.

What you get back

The REST endpoint returns the full reading as JSON:

{ "feed_id": "EIA.PET.PRICE.WTI.DAILY", "value": 78.94, "amount": "78940000", "decimals": 6, "unit": "$/bbl", "title": "Cushing, OK WTI Spot Price FOB", "source": "EIA APIv2", "route": "petroleum/pri/spt", "frequency": "daily", "period": 20260622, "source_hash": "a1b2c3…", "updated_at": 1781740800000 }

The SDK getReading() returns the same shape as a typed object, except amount is a bigint (U512-safe) rather than a string.

fieldtypemeaning
feed_idstringthe key you requested
valuenumberhuman value, amount / 10^decimals
amountstring (REST), bigint (SDK)raw integer value, U512-safe
decimalsnumberscale exponent to divide by
unitstringe.g. $/bbl
titlestringhuman-readable title
sourcestringupstream source, e.g. EIA APIv2
routestringupstream EIA dataset route
frequencystringcadence, e.g. daily
periodnumberreporting period (YYYYMMDD / YYYYMM / YYYY)
source_hashstringsha256 provenance of the source row
updated_atnumberattestation time, epoch milliseconds

period is the period the data describes; updated_at is when Claros attested it. Use both to reject stale readings before you trust a value.

Go deeper on each method

Every method reads the same on-chain data. Pick the one that matches where your code runs, then read its reference page for the full parameter and field tables.

REST, the SDK, and cross-contract reads are all free. If you want a hosted, metered endpoint where every call is settled in WCSPR over the HTTP 402 protocol, see x402 metered reads. That is how the Claros agent funds its own attestations.

Next steps

Last updated on