/v1/transactions/by_hash/{txn_hash}

Get transaction by hash

Look up a transaction by its hash. This is the same hash that is returned by the API when submitting a transaction (see PendingTransaction).

When given a transaction hash, the server first looks for the transaction in storage (on-chain, committed). If no on-chain transaction is found, it looks the transaction up by hash in the mempool (pending, not yet committed).

To create a transaction hash by yourself, do the following:

  1. Hash message bytes: "RawTransaction" bytes + BCS bytes of transaction.

  2. Apply hash algorithm SHA3-256 to the hash message bytes.

  3. Hex-encode the hash bytes with 0x prefix.

Parameters

  • txn_hash REQUIRED: (string) - Hash of transaction to retrieve

Example

Request

curl --request GET \
  --url https://aptos-mainnet.blastapi.io/<project-id>/v1/transactions/by_hash/0x7295e969a202a5f4e9a3fff708d2c6110936a8e09d5174017b5941976fa45d56 \
  --header 'Content-Type: application/json'

Result

{
  "version": "14632549",
  "hash": "0x7295e969a202a5f4e9a3fff708d2c6110936a8e09d5174017b5941976fa45d56",
  "state_change_hash": "0xafb6e14fe47d850fd0a7395bcfb997ffacf4715e0f895cc162c218e4a7564bc6",
  "event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
  "state_checkpoint_hash": "0x0dec4b1197e60a42e3c936581b7e1140623c5ee85aff067b4f25941691d8fc29",
  "gas_used": "0",
  "success": true,
  "vm_status": "Executed successfully",
  "accumulator_root_hash": "0xb8d0ee88398e517a2fc9b814978a2bbf136ea95335b846c70388fa36208111ed",
  "changes": [],
  "timestamp": "1666868948644188",
  "type": "state_checkpoint_transaction"
}

Last updated