Skip to main content
Version: 2.2

Get transaction by hash

GEThttps://mainnet-aptos-api.moralis.io/transactions/by_hash/:txn_hash

Get transaction by transaction hash.

PATH PARAMS
txn_hashstringrequired
Hash of transaction to retrieve
Responses
200 oneOf
Option 1
hashstringrequired
senderstringrequired
A hex encoded 32 byte Aptos account address.
sequence_numberstringrequired
A string containing a 64-bit unsigned integer.
max_gas_amountstringrequired
A string containing a 64-bit unsigned integer.
gas_unit_pricestringrequired
A string containing a 64-bit unsigned integer.
expiration_timestamp_secsstringrequired
A string containing a 64-bit unsigned integer returned in milliseconds.
payloadoneOfrequired
Option 1
typestringrequired
functionstringrequired
Entry function id is string representation of a entry function defined on-chain.
type_argumentsarrayrequired
Type arguments of the function
string
argumentsarrayrequired
Arguments of the function
string
signatureoneOfrequired
Option 1
typestringrequired
signaturestringrequired
All bytes (Vec) data is represented as hex-encoded string prefixed with 0x and fulfilled with two hex digits per byte
public_keystringrequired
All bytes (Vec) data is represented as hex-encoded string prefixed with 0x and fulfilled with two hex digits per byte.
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.AptosApi.transactions.getTransactionByHash({
"network": "mainnet"
});

console.log(response);
} catch (e) {
console.error(e);
}
Response Example
{
"hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
"sequence_number": "32425224034",
"max_gas_amount": "32425224034",
"gas_unit_price": "32425224034",
"expiration_timestamp_secs": "32425224034"
}