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

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_hash string required

Hash of transaction to retrieve

Response Header:

X-APTOS-BLOCK-HEIGHT integer

Current block height of the chain

X-APTOS-CHAIN-ID integer

Chain ID of the current chain

X-APTOS-EPOCH integer

Current epoch of the chain

X-APTOS-LEDGER-OLDEST-VERSION integer

Oldest non-pruned ledger version of the chain

X-APTOS-LEDGER-TIMESTAMPUSEC integer

Current timestamp of the chain

X-APTOS-LEDGER-VERSION integer

Current ledger version of the chain

X-APTOS-OLDEST-BLOCK-HEIGHT integer

Oldest non-pruned block height of the chain

Response Body:

object

Type string

Hash string

sender string<hex> required

A hex encoded 32 byte Aptos account address.

sequence_number string<uint64> required

A string containing a 64-bit unsigned integer.

max_gas_amount string<uint64> required

A string containing a 64-bit unsigned integer.

gas_unit_price string<uint64> required

A string containing a 64-bit unsigned integer.

expiration_timestamp_secs string<uint64> required

A string containing a 64-bit unsigned integer.

payload object required

Payload which runs a single entry function, or

Payload which runs a script that can run multiple functions, or

An enum of the possible transaction payloads

signature object required

A single Ed25519 signature, or

A Ed25519 multi-sig signature, or

Multi agent signature for multi agent transactions

Example:

// Request
curl -X GET -H 'Content-Type: application/json' https://aptos.blockpi.network/aptos/v1/your_api_key/v1/transactions/by_hash/0xe4cc358f3c1184cb1787b41fc52dfcfc25a2609ada71b8aa6fc9b3e4428d9475


// Result
{
    "version": "36173264",
    "hash": "0xe4cc358f3c1184cb1787b41fc52dfcfc25a2609ada71b8aa6fc9b3e4428d9475",
    "state_change_hash": "0x733e205fd66281683722f1a9446aa18a66b67ad7cdb2b01c8f947eda91f20b16",
    "event_root_hash": "0x8aa679c968e4450352db938fad90be53fb8fc3b18c97cebc39b396bea173ae22",
    "state_checkpoint_hash": null,
    "gas_used": "994",
    "success": true,
    "vm_status": "Executed successfully",
    "accumulator_root_hash": "0x87aa62641c889446f6c20673354eefd2a568e6730f5e19fe12ad12fc33ac0e32",
    "changes": [
        {
            "address": "0x9e5cf6e900fecbb716eb64781d40a5b1db9652caa6b61c188184b28c41687db2",
            "state_key_hash": "0xb59d2fe490a2aaa6aa8907958508e7e9aab8a6ca0371466b0d58beabe9cdc15a",
            "data": {
                "type": "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
                "data": {
                    "coin": {
                        "value": "600"
                    },
                    "deposit_events": {
                        "counter": "1",
                        "guid": {
                            "id": {
                                "addr": "0x9e5cf6e900fecbb716eb64781d40a5b1db9652caa6b61c188184b28c41687db2",
                                "creation_num": "2"
                            }
                        }
                    },
                    "frozen": false,
                    "withdraw_events": {
                        "counter": "0",
                        "guid": {
                            "id": {
                                "addr": "0x9e5cf6e900fecbb716eb64781d40a5b1db9652caa6b61c188184b28c41687db2",