For the complete documentation index, see llms.txt. This page is also available as Markdown.

construction/hash - Cardano

Example code for the construction/hash JSON-RPC method. Complete guide on how to use construction/hash JSON-RPC in GetBlock Web3 documentation.

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.

Field
Type
Required
Description

network_identifier

object

Yes

The network to construct for

signed_transaction

string

Yes

The signed transaction CBOR hex

Request

curl --location --request POST 'https://go.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
const response = await fetch(
    'https://go.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
import requests

response = requests.post(
    'https://go.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

Response Parameters

Field
Type
Description

transaction_identifier

object

The 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 Code
Message
Description

1

Invalid request

A required construction field is missing or malformed

6

Transaction decode failed

The supplied transaction could not be decoded

14

Invalid signature

A supplied signature is malformed or does not match

5

Internal error

The node failed to process the construction step

Was this helpful?