Kupo
By CardanoSolutions
This page provides instructions on how to interact with the Kupo service offered by Demeter.
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.
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.
To enable access in your project, you need to add a Cardano Kupo Port resource:
Once created, your Cardano Kupo Port resource will present you with the required information to request the Kupo instance:
NETWORK.kupo-v1.demeter.run
)KEY.NETWORK.kupo-v1.demeter.run
)dmtr-api-key
: dmtr_kupo63j21khsjx
)The above value will change for each project depending on your configuration.
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