Price Quotes

Upon request, the price oracle provides a price quote, which is a signed attestation of the BTC/USD exchange rate at a specified timestamp. If no timestamp is specified, the latest available price is used.

Each request must include a threshold price, which is the price level at which a threshold key may be revealed. The oracle uses this threshold price, along with other data, to compute a threshold key. This key is hashed using the HASH160 algorithm, and the resulting hash is returned alongside the price quote.

Price quotes are requested using the following URL format:

GET https://price-oracle-url/quote?th=<THRESHOLD_PRICE>&ts=<QUOTE_STAMP>

If a quote is requested with a specific timestamp, the oracle must check whether the BTC/USD price has crossed the threshold price between that timestamp and the current time.

If the threshold has been crossed, then the is_expired boolean must be set to true, and price oracle must provide the threshold key with the quote, along with the price and timestamp at which the threshold was first observed to have been crossed.

If the threshold has not been crossed, then the is_expired boolean must be set to false, and the relevant fields (thold_key, expiry_price, expiry_stamp) must be set to null.

The price oracle must securely store an HMAC_SECRET key (used to generate threshold keys), and SIGN_SECRET key.

Last updated

Was this helpful?