Canton request-response oracle

Real-time Reference Rates & Indices on Canton

circle-info

This guide provides step-by-step instructions for creating market data requests to Kaiko using the Kaiko oracle on the Canton blockchain. You can see our full range of Reference Rates and Multi-Asset Indices available on Canton herearrow-up-right.

Overview

The Kaiko oracle enables secure, paid/licensed requests for real-time Reference Rates and Multi-Asset Indices through the Canton blockchain. The system follows the standard request-response oracle workflow:

  1. Prepare request parameters: Format the Kaiko-specific payload.

  2. Retrieve contracts: Get the current Amulet rules and open mining round contracts.

  3. Exercise a contract choice: Submit a transaction to create a data request.

The oracle processes the request off-chain (settling payment via Amulets) and posts the Kaiko market data response back on-ledger.

Prerequisites

Required information

You need the following information before starting:

  • Canton participant endpoint: URL of your Canton participant JSON API

  • Canton authentication token: Valid token for API access

  • Consumer party ID: Your party identifier in Canton (e.g., Consumer::1220...)

  • RequestFactory contract ID: Contract ID for the request factory

  • DSO party ID: DSO party identifier

  • Data provider details (provider-dependent): Data request payload (stringified JSON)

  • Amulet contract ID: An Amulet contract to fund payment

  • Payment locked amount: Amount to lock for the request

Environment setup

Ensure you have:

  • A Canton node connected to the same domain as the oracle node

  • The Prepaid Oracle DAR uploaded to your Canton node

  • Sufficient Amulet balance for the request

Creating a Data Request

Prepare provider request parameters

The Kaiko oracle accepts requests for one or more tickers (real-time reference rates and indices).

Input model (Kaiko)

You must prepare the payload as valid JSON and then stringify it for the Canton command.

  • rates (Required): Array of Kaiko tickers.

Example tickers:

  • KK_RFR_BTCUSD

  • KK_RFR_CCUSD

  • EGLXRT

Stringidied payload

When sending the request to Canton, pass the stringified version (quotes escaped):

Submit the request creation transaction

Make a POST request to Canton to exercise the CreateRequest choice.

Request Endpoint:

POST

{PARTICIPANT_NODE_JSON_API_URL}/v2/commands/submit-and-wait-for-transaction-tree

Headers

  • Authorization: Bearer {CANTON_TOKEN}

  • Content-Type: application/json

Request body example:

Reading the FilledRequest

Once the oracle processes your request, it archives the pending request and creates a FilledRequest contract containing the Kaiko data.

Query for FilledRequest

Use the active contracts endpoint to retrieve the result.

Request endpoint

POST

{PARTICIPANT_NODE_JSON_API_URL}/v2/state/active-contracts

Request body filter: filter for template

{PACKAGE_ID}:PrepaidOracle.Request:FilledRequest.

Kaiko response structure

In the resulting FilledRequest contract, the responseData field contains the stringified Kaiko output.

Response data model (Kaiko)

The response is a JSON object keyed by rate id(s), containing the returned value(s).

Example (conceptual):

Example FilledRequest content

Troubleshooting

Invalid JSON structure

  • Cause: The dataRequest string was not properly escaped or contained invalid JSON.

  • Solution: Ensure your stringified JSON does not contain unescaped quotes, stray backslashes, or newlines.

Unknown/unsupported rate identifier

  • Cause: One or more requested rate identifiers are not available to your entitlement, are misspelled, or are not supported by the oracle.

  • Solution: Validate the exact rate tickers (e.g., KK_RFR_BTCUSD), confirm access/entitlements, and retry with supported identifiers.

Last updated

Was this helpful?