I've read the Oracle implementation recently via https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week6.html.

As I understand, Oracle has 2 primary operations the following

  1. Use: an Oracle UTxO will be used to execute a transaction
  2. Update: As part of the EUTxO model/blockchain, every data in the chain are immutable, meaning Oracle data can't be updated itself. It requires update operations to update the data. For instance ADA/USD ratio rate.

Due to the update operation, there are 2 questions that come to my mind. Could anyone please help to explain this to me, please?

  1. How frequently will Oracle data be updated? I think there would have different answers for different scenarios, but I don't know any specific cases in practice yet. It would be good if you could help to estimate costs for them based on scenarios.
  2. I suppose we have the off-chain part to send transactions for updating Oracle data. So what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.

If you have any idea about the way Indigo https://indigoprotocol.io/ (or any other launched products on the Cardano ecosystem) implement their Oracle, It would be very appreciated if you could add them here.

Thank you very much!

1 Answer 1


Since Indigo has just open-sourced their smart contracts including Oracle. I've just found answers to my questions.

Question 1: How frequently will Oracle data be updated?

Answer: It depends on protocols, for the specific cases of Indigo is once per hour at launch as stated in their whitepaper. "Periodically, Indigo receives price data from the outside world via Oracles. The rate at which price feeds are updated is configurable, and at launch will be set to once per hour."

Question 2: what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.

Answer: As I checked Indigo’s source code, they added an expiry time for update operations in the datum. Thus, in case price feeds are not being updated for a longer time than the expiry time, the UTxOs will not be validated to consume unless price feeds are refreshed.

see, https://github.com/IndigoProtocol/indigo-smart-contracts/blob/main/src/Indigo/Contracts/Oracle/Common.hs#L44-L64

data OracleParams = OracleParams
  { -- | Owner of the Oracle - the PubKeyHash that can
    -- update the authentic Oracle output with NFT
    opOwner :: Spooky.PubKeyHash,
    -- | the time offset by which a time approximation is considered valid
    opBiasTime :: POSIXTime,
    -- | the time how long the oracle is active
    opExpirationTime :: POSIXTime
  deriving (Generic, P.Show, ToJSON, FromJSON, P.Eq, P.Ord, OpenApi.ToSchema)

PlutusTx.makeLift ''OracleParams
PlutusTx.makeIsDataIndexed ''OracleParams [('OracleParams, 0)]

data OracleDatum = MkOracleDatum
  { -- | Price in lovelace with decimal places
    odPrice :: OnChainDecimal,
    odExpiration :: POSIXTime
  deriving stock (P.Show, Generic)
  deriving anyclass (ToJSON, FromJSON)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.