Prerequisites

Before submitting an API request, ensure you have completed the following:
  • Created an Account
  • Created a Project

Steps to Submit an API Request

The Blockchain Indexer API allows applications to retrieve on-chain data and submit transactions. In this example, we will use the Pre-Production Cardano network as the selected network for our project.

1. Select the Network

  • Ensure your project is configured to use the Pre-Production Cardano network.

2. Retrieve Transaction Output

  • Use the following endpoint to get detailed information about a transaction and its output UTxO:
/transactions/{tx_hash}/outputs/{index}/txo

3. Specify Path Parameters

  • Include the required path parameters in your request:
ParameterData TypeDescriptionRequired
tx_hashStringThe unique identifier of the transaction.yes
indexIntegerThe output index is specifying which UTxO to retrieve.yes

4. Specify Query Parameters (Optional)

  • Include optional query parameters as needed:
ParameterData TypeDescriptionRequired
with_cborBooleanSet to true to include the CBOR encoding of the transaction output in the response.no

5. Send the API Request

  • Use cURL or your preferred tool to send the API request:
For this example, we will use:
  • tx_hash: 9907c1bcab96889368d975ec1964e2fedfef22ce4a0e367bf9cb621b9f0dcb4a
  • index: 0
  • with_cbor: true
curl -X GET \
  -H "api-key: <your_project_api_key>" \
  -H 'Accept: application/json' \
 https://preprod.gomaestro-api.org/v1/transactions/9907c1bcab96889368d975ec1964e2fedfef22ce4a0e367bf9cb621b9f0dcb4a/outputs/0/txo?resolve_datums=true&with_cbor=true

6. Review the Response

The API will return a response like the following:
"data": {
    "tx_hash": "9907c1bcab96889368d975ec1964e2fedfef22ce4a0e367bf9cb621b9f0dcb4a",
    "index": 0,
    "assets": [
        {
            "unit": "lovelace",
            "amount": 7280082022
        },
        {
            "unit": "34250edd1e9836f5378702fbf9416b709bc140e04f668cc3552085184154414441636f696e",
            "amount": 10824
        }
    ],
    "address": "addr_test1vpfwv0ezc5g8a4mkku8hhy3y3vp92t7s3ul8g778g5yegsgalc6gc",
    "datum": null,
    "reference_script": null,
    "txout_cbor": "a200581d6052e63f22c5107ed776b70f7b92248b02552fd08f3e747bc74509944101821b00000001b1ed3c66a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e192a48"
},
"last_updated": {
    "timestamp": "2024-09-06 13:56:56",
    "block_hash": "ca6cf1b408ee8eb02019bce77995c5ed5983c2b553b1b6b2fcecfaaf72d1fc59",
    "block_slot": 69947816
}

7. Understanding the Response

TermDefinition
tx_hashThe unique hash identifier of a transaction.
indexThe index position of the transaction output (UTxO).
assets unitThe reference for native assets, either hex(policy_id)#hex(asset_name) or lovelace.
assets quantityThe quantity of the native asset.
addressThe address controlling the UTxO.
datum typeType of datum: either inline or hash.
datum hashThe hash of the datum.
datum bytesHex-encoded CBOR bytes of the datum (null if datum type is hash and corresponding datum bytes have not been seen on-chain).
datum jsonJSON format of the datum value.
reference_script typeThe type of reference script: native, plutusv1, or plutusv2.
reference_script hashThe hash of the reference script.
reference_script bytesThe script bytes (null if the script is native).
reference_script jsonJSON format of the script.