# get_transaction

Fetches a transaction by hash, then makes a separate receipt request for receipt metadata.

Canonical HTML: <https://determica.com/docs/functions/get_transaction>

- Kind: table function
- Category: [Chain reads](/docs/category/chain-reads.md)
- Tags: RPC

Fetches a transaction by hash, then makes a separate receipt request for receipt metadata.

## Overload 1: get_transaction(CLIENT, BYTES32)

```sql
get_transaction(CLIENT, BYTES32)
```

Accepts a transaction hash as an exact BYTES32 value.

- Kind: table
- Execution context: Live RPC
- Behavior: Immediate Read
- Execution modes: Live Client
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: Zero Or More
- Determinism: External State
- Return shape: Table
- Schema stability: Fixed
- Stability: Stable
- Side effects: network_io

### Requirements

- attached_live_client
- rpc

### Risks

- provider_limits
- chain_reorganization

### Inputs

- `client` (CLIENT; required; positional) — Attached live CLIENT for the chain where the transaction exists.
- `tx_hash` (BYTES32; required; positional) — Transaction hash as BYTES32 or a VARCHAR containing exactly 64 hexadecimal digits, with an optional 0x or 0X prefix.

### Result columns

Transaction and receipt metadata

Returns one row per input hash. Receipt columns are NULL when the receipt request fails or has no result. If the client or transaction result is unavailable, every column in the row is NULL.

- `hash` (BYTES32) — Transaction hash.
- `block_hash` (BYTES32) — Containing block hash; NULL when pending.
- `block_number` (BLOCK_NUMBER) — Containing block height; NULL when pending.
- `transaction_index` (INTEGER) — Position within the block.
- `from` (ADDRESS) — Sender address.
- `to` (ADDRESS) — Recipient; NULL for contract creation.
- `value` (UINT256) — Native value in Wei.
- `gas` (GAS) — Transaction gas limit.
- `gas_price` (BIGINT) — Legacy gas price in Wei.
- `max_fee_per_gas` (BIGINT) — EIP-1559 maximum fee in Wei.
- `max_priority_fee_per_gas` (BIGINT) — EIP-1559 priority-fee cap in Wei.
- `input` (BYTES) — Calldata or contract init code.
- `nonce` (BIGINT) — Sender account nonce.
- `type` (INTEGER) — EIP-2718 transaction type.
- `v` (INTEGER) — Signature recovery value.
- `r` (BYTES32) — Signature r component.
- `s` (BYTES32) — Signature s component.
- `contract_address` (ADDRESS) — Created contract address, when applicable.
- `gas_used` (GAS) — Transaction gas consumed.
- `cumulative_gas_used` (GAS) — Block gas consumed through this receipt.
- `effective_gas_price` (BIGINT) — Actual Wei paid per gas.
- `receipt_status` (BOOLEAN) — Whether execution succeeded.
- `logs_bloom` (BYTES256) — Receipt-log bloom filter.
- `blob_gas_used` (BIGINT) — EIP-4844 blob gas consumed.
- `blob_gas_price` (BIGINT) — Wei paid per blob gas.

Transaction and receipt metadata. Returns one row per input hash. Receipt columns are NULL when the receipt request fails or has no result. If the client or transaction result is unavailable, every column in the row is NULL.

### Examples

_Named parameters · Needs RPC · RPC required_

```sql
-- Block, sender, recipient and receipt status of one transaction
SELECT block_number, "from" AS sender, "to" AS recipient, receipt_status, gas_used
FROM get_transaction(
  $client,
  '0x9517e2bc102ae3cde3963c2d2811b64402c3ddaa562206a42a0a1472aadd93a4'::BYTES32
);
```

## Overload 2: get_transaction(CLIENT, VARCHAR)

```sql
get_transaction(CLIENT, VARCHAR)
```

Accepts exactly 64 hexadecimal digits with an optional 0x or 0X prefix; other values are rejected.

- Kind: table
- Execution context: Live RPC
- Behavior: Immediate Read
- Execution modes: Live Client
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: Zero Or More
- Determinism: External State
- Return shape: Table
- Schema stability: Fixed
- Stability: Stable
- Side effects: network_io

### Requirements

- attached_live_client
- rpc

### Risks

- provider_limits
- chain_reorganization

### Inputs

- `client` (CLIENT; required; positional) — Attached live CLIENT for the chain where the transaction exists.
- `tx_hash` (VARCHAR; required; positional) — Transaction hash as BYTES32 or a VARCHAR containing exactly 64 hexadecimal digits, with an optional 0x or 0X prefix.

### Result columns

Transaction and receipt metadata

Returns one row per input hash. Receipt columns are NULL when the receipt request fails or has no result. If the client or transaction result is unavailable, every column in the row is NULL.

- `hash` (BYTES32) — Transaction hash.
- `block_hash` (BYTES32) — Containing block hash; NULL when pending.
- `block_number` (BLOCK_NUMBER) — Containing block height; NULL when pending.
- `transaction_index` (INTEGER) — Position within the block.
- `from` (ADDRESS) — Sender address.
- `to` (ADDRESS) — Recipient; NULL for contract creation.
- `value` (UINT256) — Native value in Wei.
- `gas` (GAS) — Transaction gas limit.
- `gas_price` (BIGINT) — Legacy gas price in Wei.
- `max_fee_per_gas` (BIGINT) — EIP-1559 maximum fee in Wei.
- `max_priority_fee_per_gas` (BIGINT) — EIP-1559 priority-fee cap in Wei.
- `input` (BYTES) — Calldata or contract init code.
- `nonce` (BIGINT) — Sender account nonce.
- `type` (INTEGER) — EIP-2718 transaction type.
- `v` (INTEGER) — Signature recovery value.
- `r` (BYTES32) — Signature r component.
- `s` (BYTES32) — Signature s component.
- `contract_address` (ADDRESS) — Created contract address, when applicable.
- `gas_used` (GAS) — Transaction gas consumed.
- `cumulative_gas_used` (GAS) — Block gas consumed through this receipt.
- `effective_gas_price` (BIGINT) — Actual Wei paid per gas.
- `receipt_status` (BOOLEAN) — Whether execution succeeded.
- `logs_bloom` (BYTES256) — Receipt-log bloom filter.
- `blob_gas_used` (BIGINT) — EIP-4844 blob gas consumed.
- `blob_gas_price` (BIGINT) — Wei paid per blob gas.

Transaction and receipt metadata. Returns one row per input hash. Receipt columns are NULL when the receipt request fails or has no result. If the client or transaction result is unavailable, every column in the row is NULL.

## Guidance

### Snapshot and receipt context

Transaction hashes are chain-scoped. Use a CLIENT for the chain where the transaction was submitted.

Receipt fields can be absent while a transaction is pending or when the receipt request fails.

Persist block_number and block_hash when later queries must use the same mined snapshot.

### Transaction evidence

Pair get_transaction with get_transaction_logs when analysis needs both transaction metadata and emitted events.

## Related functions

- [get_transaction_logs](/docs/functions/get_transaction_logs.md) — Usually Before
- [get_block](/docs/functions/get_block.md) — See Also
