v2

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2022-07-19176455.9 KB
transactions

Get transaction

There are two types of transaction identifiers:

  1. Transaction hash: included in any transaction JSON respond from server.
  2. Transaction version: included in on-chain transaction JSON respond from server.

When given transaction hash, server first looks up on-chain transaction by hash; if no on-chain transaction found, then look up transaction by hash in the mempool (pending) transactions.

When given a transaction version, server looks up the transaction on-chain by version.

To create a transaction hash:

  1. Create hash message bytes: "APTOS::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.
get/transactions/{txn_hash_or_version}

Path parameters

txn_hash_or_versionstring required
  • Transaction hash should be hex-encoded bytes string with 0x prefix.
  • Transaction version is an uint64 number.

Response

Returns a pending / on-chain transaction.

OR
OR
OR
OR

Example response

{
  "type": "pending_transaction",
  "hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
  "sender": "0xdd",
  "sequence_number": "32425224034",
  "max_gas_amount": "32425224034",
  "gas_unit_price": "32425224034",
  "gas_currency_code": "XDX",
  "expiration_timestamp_secs": "1635447454",
  "payload": {
    "type": "script_function_payload",
    "function": "0x1::payment_scripts::peer_to_peer_with_metadata",
    "type_arguments": [
      "0x1::xdx::XDX"
    ],
    "arguments": [
      "0x1668f6be25668c1a17cd8caf6b8d2f25",
      "2021000000",
      "0x",
      "0x"
    ]
  },
  "signature": {
    "type": "ed25519_signature",
    "public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
    "signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
  }
}