Price Quotes
Upon request, the price oracle will provide a “price quote”, which is a signed attestation of the BTC / USD exchange price at a specified timestamp. If no timestamp is specified in the request, then the latest recording of the price is used.
Each request must include a “threshold price”, which is the price at which a threshold key will be revealed. The price oracle will use this threshold price (plus other data) to compute a “threshold key”. This key is obfuscated using a hashing algorithm (HASH160), and the hash is provided with the quote.
Price quotes are requested using the following URL format:
GET https://price-oracle-url/quote?th=<THRESHOLD_PRICE>&ts=<QUOTE_STAMP>
If a user requests a quote with a specific timestamp, the price oracle must check if the BTC / USD exchange price has crossed the threshold price for the quote (between the quote timestamp, and the current timestamp).
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?