Get Transaction by Hash

Look up a transaction by its hash.

This method will use 15 Compute Units.


Get transaction by hash

get

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.
Path parameters
txn_hashstringRequired

Hash of transaction to retrieve

Responses
200Success
Responseone of

Enum of the different types of transactions in Aptos

all ofOptional
and
or
all ofOptional
and
or
all ofOptional
and
or
all ofOptional
and
or
all ofOptional
and
get
GET /v1/<YOUR_API_KEY_HERE>/v1/transactions/by_hash/{txn_hash} HTTP/1.1
Host: mainnet.aptos.validationcloud.io
Accept: */*
{
  "type": "pending_transaction",
  "hash": "text",
  "sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
  "sequence_number": "32425224034",
  "max_gas_amount": "32425224034",
  "gas_unit_price": "32425224034",
  "expiration_timestamp_secs": "32425224034",
  "payload": {
    "type": "entry_function_payload",
    "function": "0x1::aptos_coin::transfer",
    "type_arguments": [
      "text"
    ],
    "arguments": []
  },
  "signature": {
    "type": "ed25519_signature",
    "public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
    "signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 "
  }
}

Last updated

Was this helpful?