Cardano APIs — XRAY | Graph

XRAY | Network
5 min readMar 1, 2024

Cardano blockchain data and how to work with it

Working with blockchain data requires a lot of effort — node stores data in a very compressed format that takes up the least amount of space, but still the size of these databases is in the tens or even hundreds of gigabytes — at the time of writing, the Cardano blockchain takes up about 200 gigabytes.

Displaying data to customers in an application such as a wallet requires historical data that is nearly impossible to retrieve in a reasonable amount of time directly from a node database — for this purpose, there are specialized indexers that store historical data in schemas that allow various complex queries to be requested in milliseconds.

But installing, configuring and maintaining these tools requires relevant skills such as a good understanding of Cardano blockchain architecture, Linux and database administration. And importantly you need hardware — powerful servers that can handle the load of your application. All this can delay your development for weeks and months, which is unacceptable in the era of serverless and distributed solutions.

And the XRAY | Network team has solutions.

XRAY | Graph | Studio & Output

XRAY | Graph is a solution that allows developers to instantly access Cardano blockchain data.

This service is divided into two groups:

  • Graph | Studio
  • Graph | Output

Studio is a tool for creating narrow APIs by editing YML configs directly in a web browser (thanks Visual Studio Code and OpenAPI!), and then running an indexer that adds data block by block to the Timescale DB — to then extract the raw and aggregated data to end applications in a matter of milliseconds. Pricing APIs (Minswap trade data, Wingriders, etc) will also be added here as well as some other working examples that you can fork and create your own API based on this.

Output is a set of open-source tools for working with Cardano that are deployed in the XRAY cloud cluster. You can see the list of such tools below.

XRAY | Graph will have two tiers — Basic and Premium. The balance will be deducted for each request and can only be topped up in XRAY — we are happy to announce the first utility of XRAY token.

Tentatively, the cost per request will be pegged to 0.000001$ or 0.000063 XRAY (at the time of writing). Ogmios WebSocket request (outbound message) will cost x 0.1 of the standard request price.

XRAY | Graph UI
API              Graph | Studio * TBA
Description Building APIs and data indexing via WYSIWYG editor
Docs TBD
Example Query TBD

API Graph | Studio | Pricing API * TBA
Description Tokens trading data on popular Cardano DEXs, part of Studio default APIs
Docs TBD
Example Query TBD

API Graph | Output | NFTCDN * LIVE
Description Metadata/datums indexer/explorer and images CDN
Docs https://github.com/xray-network/xray-graph-nftcdn
Example Query https://graph.xray.app/output/nftcdn/mainnet/api/v1/assets
https://graph.xray.app/output/nftcdn/mainnet/api/v1/image/asset14f902f0vmsg5fpg90427674mmrkyc56ht2qx3j?size=256
https://graph.xray.app/output/nftcdn/mainnet/api/v1/metadata/asset14f902f0vmsg5fpg90427674mmrkyc56ht2qx3j

API Graph | Output | Ogmios * LIVE
Description Lightweight bridge interface for cardano-node
Docs https://ogmios.dev
Example Query https://graph.xray.app/output/ogmios/mainnet/api/v1/health

API Graph | Output | Kupo * LIVE
Description Cardano chain-indexer
Docs https://cardanosolutions.github.io/kupo/
Example Query https://graph.xray.app/output/kupo/mainnet/api/v1/health

API Graph | Output | Koios Tiny * LIVE
Description Postgrest query layer to Cardano-DB-Sync
Docs https://api.koios.rest/
Example Query https://graph.xray.app/output/koios/mainnet/api/v1/health
https://graph.xray.app/output/koios/mainnet/api/v1/blocks
                                     Basic Tier *    Premium Tier **

Graph | Studio ✅ ✅
Graph | Studio | Pricing API ✅ ✅
Graph | Output | NFTCDN ✅ ✅
Graph | Output | Ogmios ✅ ✅
Graph | Output | Ogmios WS *** ❌ ✅
Graph | Output | Kupo ❌ ✅
Graph | Output | Koios Tiny ✅ ✅

* Basic Tier: 30 sec timeout, 200 requests per 2 minute per IP/domain.
** Premium Tier: 120 sec timeout, prioritized unlimited requests per IP/domain until balance is exhausted, limits and allowed IPs/domains can be customized.
*** Ogmios via websockets is only available on Premium Tier, unlimited requests per IP/domain until balance is exhausted, request (outbound message) price is x 0.1 of default request price.

Calculations

As we wrote above, all prices will be calculated in XRAY, for ease of understanding they will be specified in $.

For example, we will calculate a project that uses per month:

  • Ogmios WS: Blocks indexing to retrieve the necessary transaction metadata for smart contract assembly
  • Koios Tiny: Serving data for the frontend application
  • NFTCDN: Serving assets images & metadata
API                 Requests       Price/Request      Total

Ogmios WS 100,000 0.0000001$ 0.01$
Koios Tiny 2,000,000 0.000001$ 2$
NFTCDN 1,000,000 0.000001$ 1$

Comparison with competitors

Provider            Price/Month    Comparison

XRAY | Graph * 3.01$ x1 ██
Blockfrost ** 29€ x10.4 ██████████████████████
Demeter.run ** 13.5$ x4.49 ██████████

* XRAY | Graph: Pay-as-you-go per request, pay in XRAY.
** Competitors: Monthly subscription, pay in fiat money, direct access to asset images is not available (no nftcdn), so you will have to develop and maintain additional parsers.

XRAY | Graph | Turbo TX Send

API              Graph | Turbo TX Send
Description Accelerating TXs sending for Cardano blockchain
Requests Unlimited
Docs https://github.com/xray-network/cloudflare-worker-turbo-tx-send
Example Query GET/POST https://graph.xray.app/turbo-tx-send/mainnet

XRAY | Graph | Stats

API              Graph | Stats
Description Statistics of various indicators for Cardano and XRAY
Requests Unlimited
Docs https://github.com/xray-network/cloudflare-worker-stats
Example Query https://graph.xray.app/stats/xray
https://graph.xray.app/stats/cardano

Architecture

Graph service is divided into two components:

  1. Kubernetes cluster for deploying back-end services such as Cardano Node (Ogmios), NFTCDN, Redis, Timescale DB (Postgres) and other tools.
  2. Cloudflare Workers works as an intermediate layer between services and end users, here we transform and route requests, verify access and manage connection limits. This is also where we add the documentation in OpenAPI format for our APIs.

What’s Next

We have made all the necessary APIs, and the order of releases for the near future will be as follows:

  1. XRAY | Graph Homepage + Studio & Pricing APIs + OpenAPI Docs + Premium Tier
  2. XRAY.app Homepage
  3. CardanoList.io

Then we have prepared some of the following and look forward to showing it to you soon: XRAY | Wallet, XRAY | Stake, XRAY | Launchpad, XRAY | Swap, XRAY | Faucet, XRAY | Explorer! And lastly, Minterr.io and Pigz.io!

By the way, we’ll soon be releasing a series of articles on how to make a completely serverless dApp that lives on Cloudflare Edge for free — simply by using XRAY | Graph and Cloudflare Workers. And as loads grow, you’ll be able to simply switch to a paid plan — XRAY | Graph Premium Tier and Cloudflare Workers Paid.

We are waiting for you on our social media channels! 👋

--

--

XRAY | Network

An advanced DeFi ecosystem for Cardano blockchain platform