BACK TO PRODUCTS

Kupo

By

By CardanoSolutions

This page provides instructions on how to interact with the Kupo service offered by Demeter.

About Kupo

Kupo is fast, lightweight and configurable chain-index for the Cardano blockchain. It synchronizes data from the blockchain according to patterns matching addresses present in transaction outputs and builds a lookup table from matches to their associated output references, values, datums and scripts.

Demeter Implementation

Each Demeter cluster provides highly-available, multi-tenant instances of Cardano Kupo. Requests to these instances are load balanced. Projects can request Kupo from an HTTP client.

Demeter Kupo will consume DCUs from your project's wallet proportional to the volume of the requests. If no requests are executed, Demeter will not charge anything.

Enabling Access

To enable access in your project, you need to add a Cardano Kupo Port resource:

  1. Login to Demeter.run
  2. Select your project
  3. From your project's dashboard, click "Add Resource"
  4. Find the resource "Cardano Kupo Port" card and select it
  5. Click "Create Resource"
  6. Select the Cardano network you want to access
  7. Click "Create Resource" once again

Getting Started

Once created, your Cardano Kupo Port resource will present you with the required information to request the Kupo instance:

  • HTTP Endpoint URL: the publicly accessible hostname of the Kupo instance by network (eg: NETWORK.kupo-v1.demeter.run)
  • HTTP Authenticated Endpoint URL: the publicly accessible hostname of the Kupo instance, but with the key set on the hostname without necessary to set it on the header. (eg: KEY.NETWORK.kupo-v1.demeter.run)
  • Api Key: the key to authenticating, will needs to be set on the header (eg: dmtr-api-key: dmtr_kupo63j21khsjx)

The above value will change for each project depending on your configuration.

  • Python
  • NodeJS

You can use a library like requests to make request to a Kupo instance in Python. Here's a basic example:

If the authenticated URL is used, the header(dmtr-api-key) is not necessary to set.

import requests

try:
    host = "https://mainnet.kupo-v1.demeter.run/matches/addrXXXX"
    headers = {
        'dmtr-api-key': 'dmtr_kupoXXXX',
    }

    # Make a GET request to the API with custom headers
    response = requests.get(host, headers=headers)

    # Check if the request was successful (status code 200)
    if response.status_code == 200:
        # Parse the JSON response
        values = response.json()

        # Print the transactions ID as an example
        for value in values:
            print(f"Transaction Id #{value['transaction_id']}")
    else:
        # Print an error message if the request was not successful
        print(f"Error: {response.status_code}")

except Exception as e:
    # Handle exceptions, if any
    print(f"An error occurred: {e}")

In this code, replace host, and dmtr-api-key if is necessary

This will request to get resources from an address

1. Select type

2. Select project