construction/hash - Cardano

This endpoint returns the transaction hash of a signed transaction. The hash is the identifier the transaction will have once submitted.

Parameters

The request body is a JSON object with the following fields.

FieldTypeRequiredDescription
network_identifierobjectYesThe network to construct for
signed_transactionstringYesThe signed transaction CBOR hex

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/construction/hash' \
--header 'Content-Type: application/json' \
--data-raw '{
    "network_identifier": {
        "blockchain": "cardano",
        "network": "mainnet"
    },
    "signed_transaction": "84a400818258200e...signed-cbor..."
}'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/construction/hash',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"network_identifier": {"blockchain": "cardano", "network": "mainnet"}, "signed_transaction": "84a400818258200e...signed-cbor..."})
    }
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/construction/hash',
    headers={'Content-Type': 'application/json'},
    json={"network_identifier": {"blockchain": "cardano", "network": "mainnet"}, "signed_transaction": "84a400818258200e...signed-cbor..."}
)

print(response.json())

Response

json{
    "transaction_identifier": {
        "hash": "10b54fd708ab2e5703979b4ba27ca0339882abc2062e77fbe51e625203a49642"
    }
}

Response Parameters

FieldTypeDescription
transaction_identifierobjectThe hash the transaction will have once submitted

Use Cases

  • Pre-Submit Hashing: Compute the transaction hash before broadcasting
  • Tracking Setup: Record the hash to track the transaction later
  • Idempotency: Detect a duplicate submission by hash
  • Receipts: Return a transaction hash to a user before submission

Error Handling

Error CodeMessageDescription
1Invalid requestA required construction field is missing or malformed
6Transaction decode failedThe supplied transaction could not be decoded
14Invalid signatureA supplied signature is malformed or does not match
5Internal errorThe node failed to process the construction step