Skip to main content
Complete reference of transaction fields available in rule conditions. All fields are always available and don’t require any special configuration.

Basic Transaction Fields

Essential transaction information available in every transaction.
FieldTypeDescriptionExample
tx.hashstringTransaction hash (unique identifier)tx.hash != ""
tx.fromaddressSender addresstx.from == "0x742d35..."
tx.toaddressRecipient address (null for contract creation)tx.to in (known_addresses)
tx.valueweiTransaction value (use ether for readability)tx.value > 100 ether
tx.gasuint64Gas limittx.gas > 500000
tx.gas_priceweiGas price (use gwei for readability)tx.gas_price > 100 gwei
tx.gas_useduint64Actual gas consumed (from receipt)tx.gas_used > 100000
tx.inputhexTransaction input data (calldata, raw)len(tx.input) > 100
tx.nonceuint64Transaction noncetx.nonce == 0
tx.statusuint64Transaction status (0=failed, 1=success)tx.status == 1
tx.logs_countintNumber of event logs emittedtx.logs_count > 5

Block Data

Block-level context for the transaction.
FieldTypeDescriptionExample
tx.block.numberuint64Block numbertx.block.number > 18000000
tx.block.timestampuint64Block timestamp (Unix timestamp)tx.block.timestamp > 1234567890

Function Selectors

Check function selectors using the startswith() function:
# ERC-20 transfer() function
condition: startswith(tx.input, "0xa9059cbb")

# ERC-20 approve() function
condition: startswith(tx.input, "0x095ea7b3")

Arrays: Event Logs, Transfers, and Approvals

Blocklight automatically parses event logs and provides three arrays for easy access:

tx.logs - Raw Event Logs

Raw event logs emitted by contracts. Use with array methods (.any(), .count()).
PropertyTypeDescriptionExample
addressaddressContract that emitted the logtx.logs.any(address == "0x...")
event_signaturestringEvent signature hash (topic[0])tx.logs.any(event_signature == "0xddf...")
event_namestringParsed event nametx.logs.any(event_name == "Transfer")
Recognized Events: Transfer, Approval, ApprovalForAll, Unknown

tx.transfers - Parsed ERC-20 Transfers

ERC-20 Transfer events automatically parsed for easy access.
PropertyTypeDescriptionExample
contractaddressToken contract addresstx.transfers.any(contract == "0x...")
fromaddressSource address (padded 32 bytes)tx.transfers.any(from == "0x0000...")
toaddressDestination address (padded 32 bytes)tx.transfers.any(to == "0x0000...")
amountstringTransfer amount (hex string)tx.transfers.any(amount != "0x0")
Address Format: Addresses in tx.transfers are padded to 32 bytes (64 hex characters) as they appear in event topics. Example: 0x000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f0beb

tx.approvals - Parsed ERC-20 Approvals

ERC-20 Approval events automatically parsed. Essential for detecting unlimited approvals and approval-based attacks.
PropertyTypeDescriptionExample
contractaddressToken contract addresstx.approvals.any(contract == "0x...")
owneraddressOwner address (padded 32 bytes)tx.approvals.any(owner == "0x0000...")
spenderaddressSpender address (padded 32 bytes)tx.approvals.any(spender == "0x0000...")
amountstringApproval amount (hex string)tx.approvals.any(amount != "0x0")
Address Format: Addresses in tx.approvals are padded to 32 bytes (64 hex characters) as they appear in event topics.

Unit Suffixes

Use these suffixes for better readability. Blocklight automatically converts units for you.
UnitFieldConversionExample
ethertx.value1 ether = 1018 weitx.value > 100 ether
gweitx.gas_price1 gwei = 109 weitx.gas_price > 50 gwei

Field Naming Patterns

All fields follow consistent patterns:
  • Direct properties: tx.value, tx.hash, tx.from
  • Nested structures: tx.block.timestamp, tx.block.number
  • Arrays: tx.logs, tx.transfers, tx.approvals (use with array methods)

Next Steps