Summary
Charli3’s ODV (On-Demand Validation) oracles deliver values on-chain based on user requests, providing a responsive and user-friendly experience.
Cardano smart contracts as ODV Oracles
Charli3’s ODV oracle smart contracts connect trusted external information through decentralized nodes. These nodes gather data from trusted sources and calculate the oracle feed value using a consensus algorithm when requested by DApps.
Figure 1. Visual representation of the UTXOs that a Charli3 V1 ODV Oracle Contract holds at a specific contract address.
The ODV oracle utilizes features like Plutus V3, Inline Datums, Reference Scripts, and Reference UTXOs, focusing on delivering data only when required rather than at regular intervals.
Node operator backend
Charli3’s ODV Node Operator Backend software operates as a REST API service that responds to client requests. It efficiently gathers data from multiple sources, signs feed values, and validates transactions. Developed in Python, the service leverages the Pycardano library for streamlined contract interaction.
Charli3’s ODV Network
Charli3’s ODV network consists of three components:
- ODV Oracle Smart Contract
- Node Operator Backend
- DApp Client
The Node Operator Backend maintains price feeds from multiple sources and responds to ODV requests (feed message and transaction) through its API endpoints. The ODV Oracle Smart Contract validates node signatures and calculates the consensus value, while the DApp Client or Aggregator collects responses from all nodes to construct the aggregation transaction. See Figure 2 for schematic representation of the ODV transaction.
Figure 2. Depiction of Charli3’s Network composed of Node Operators and their Interaction with the DApp User and Oracle Smart Contract on the Cardano Blockchain.
Oracle platform is an entity that creates and manages the oracle network, it consists of multiple parties - oracle operators. Platform authorized actions include things like changing oracle settings (Figure 3), adding or removing oracle nodes. All this actions are protected by an authorization token (NFT) check. Platform is keeping this NFT at a multisig address, so that oracle network is securely protected.
Figure 3. Depiction of Charli3’s Network composed of Platform Operators and its Interaction with the Oracle Smart Contract on the Cardano Blockchain.
Data consumers
Consumers can request oracle data on-demand through a two-step process:
- Request feed values from all oracle nodes
- Collect signatures on the aggregation transaction
This pull-based model ensures that data is always fresh when used.
Immediately after ODV transaction is submitted user submits a DApp transaction (e.g. a swap in Figure 4) that references the newly aggregated oracle feed. The DApp tx is submitted on the same Cardano node, therefore it sees the ODV tx state and can use it without waiting for the ODV tx to be finalized on the blockchain. That makes ODV pull based oracle model suitable for use cases when minimal latency is required, for Charli3 pull oracle implementation it is limited only by the regular network HTTP communication delay ~300 ms (a fraction of a second). ODV Oracle and ODV tx fee UTXO input must be consumed in ODV tx, smart contract won’t check whether it comes from the user wallet or a DApp subscription smart contract. Therefore DApp interested in Charli3 pull oracle integration can prepay some treasury inputs for oracle use, and update oracle feed by constructing ODV tx on a DApp back-end app. This back-end application would have on-chain guaranties from the user in the form of a trade order UTXO, so the ODV tx would not be wasted.
Figure 4. Representation of a third-party contract (Swap-contract) accessing the oracle feed.