HPIX-04: Jiritsu price oracle for Hxro - Proposal


Letter of intent
Hxro <> Jiritsu

Hxro is a decentralized network that is building software infrastructure for different financial use cases. Hxro Network’s Parimutuel Protocol requires a sophisticated oracle that can support dynamic data, sourcing, computation and auditing.

Jiritsu has developed a MPC based oracle that delivers flexible selection of price sources and verifies not only values, but also other data, which enables comprehensive auditing and transparency, in addition to specific price points that support products such as parimutuel options.

The solution
Jiritsu has been working closely with Hxro to help develop an oracle that satisfies all the requirements of the Parimutuel Protocol, as well as other important features, such as a portal for third-party probability providers.

Jiritsu is committed to support the product vigorously throughout its launch and until such time as it is stable and can be supported via a traditional commercial service agreement.

The Grant
In return for support and unlimited data feeds Hxro will issue Jiritsu a grant on the following terms:

  1. Monthly, Hxro Network will distribute 5% of the total fees collected in the Parimutuel Protocol to Jiritsu for all contracts settled through December 31, 2023, with a monthly minimum of $900. Distribution will take place within 5 days following the conclusion of each month.

Product details
Attached is a draft of product flow and specifications.


Jacob Guedalia
Founder Jiritsu

Product details
The Hxro price oracle is a Jiritsu job that:

  • Fetches prices from authoritative web source for multiple coin pairs
  • Fetches prices every minute, on the minute boundary
  • Posts the average price for each coin pair to a Solana on-chain program
  • Applies consensus across multiple nodes running the same job to ensure fetched prices are reliably reported.
  • Fetches all prices from idempotent source urls so that anyone may repeat and verify any minute’s results at any time because the results should always be the same
  • Writes a report summary to IPFS for every minute’s work and includes the hash address of that report in the on-chain transaction for accountability.

The Jiritsu job is defined by a network of interconnected calculation and logic building blocks, most of which are reusable and pre-vetted. It is possible to write a new javascript algorithm (logic block) but was not necessary for this work. The job’s behavior is recorded in json strategy files, which are meta-algorithms listing the algorithms and data bindings in a particular computational layer. There is no code in a strategy, only the mapping of pre-written javascript files and data.

Every Jiritsu job starts with one “root” strategy. Every job receives context (input data) from its caller. The root strategy takes its context from the global input defined by job’s owner when the job was created.

Below in Figure 1 is a diagram of the root strategy of the Hxro Price Oracle. It shows the data variables available in the job’s context, and how they flow through a series of child strategies (gray boxes). Each strategy shows its input data on the left, and the transformed result data on the right.

The important strategies will be broken out in subsequent figures.

Key points to notice in Figure 1:

  • One of the first child strategies invoked queries the Solana program/data account for admin config parameters (like the coin pairs to be fetched). This allows the job to be controlled via transactions from the admin wallet allowed to talk to the Solana program without modifying job code.
  • At the heart of the root strategy is the FetchPairFromAllSources child strategy, which eventually does all the actual fetches, calculations and consensus checks. Notice that it has an input variable that is labeled “Loop:” This variable expects an array (the list of all coinpairs to be checked) and causes the strategy to be run multiple times, once for each entry in the loop variable. The results of each strategy run are aggregated in the result variable as an array corresponding to the same order as the input loop array. It is very similar to a javascript map call.

FIGURE 1: Hxro Price Oracle - Root Strategy

FIGURE 2. Hxro Price Oracle - Fetch Retry Layer