Skip to main content
Use placeholders in the output field to include dynamic values in your alert messages. Format: %variable (single % prefix, no trailing %).
Important: Use %tx.hash NOT %tx.hash%. Only one % at the beginning!

Available Placeholders

Basic Transaction Fields

Matched Log Placeholders

When a rule uses tx.logs.any(...) in its condition, you can access information about the log that matched using these placeholders: Raw Fields (always available): Parsed Fields (automatically added for known events): For Transfer events (event_name == "Transfer"): For Approval events (event_name == "Approval"):
When Available: These placeholders are only populated when:
  • The rule condition uses tx.logs.any(...)
  • The condition matches (rule triggers)
  • The matched log is from tx.logs
Parsed Fields: Fields like from, to, amount, owner, spender, and contract are automatically parsed and added to the log entry when Blocklight recognizes the event (Transfer or Approval). If the matched log is not a recognized event, these parsed fields will be empty strings.If no item matched or the condition doesn’t use tx.logs.any(...), all placeholders will be empty strings.

Format Details

  • %tx.value: Raw wei value as string (e.g., "1000000000000000000")
  • %tx.value_eth: Formatted ETH value with 4 decimal places (e.g., "1.0000")
  • %tx.gas_price: Raw gas price in wei as string (e.g., "100000000000")
  • %tx.gas_price_gwei: Formatted gas price in gwei with 2 decimal places (e.g., "100.00")
  • %tx.timestamp: RFC3339 formatted timestamp (e.g., "2024-01-15T10:30:00Z")
  • %tx.timestamp_unix: Unix timestamp in seconds (e.g., "1705312200")
  • %tx.block.number: Block number (same syntax as in conditions: tx.block.number)
  • %tx.block.timestamp: Block timestamp in Unix seconds (same syntax as in conditions: tx.block.timestamp)
  • Numeric fields: All converted to strings (e.g., %tx.nonce"952")
  • Address fields: Full address in hex format (e.g., %tx.from"0x2fb074...")
Consistency: Placeholders use the same syntax as conditions. For example:
  • Condition: tx.block.number > 18000000
  • Placeholder: %tx.block.number
This ensures that any field you can use in a condition can also be used as a placeholder in the output.

Example Usage

Basic Transaction Information

Using Matched Log Placeholders

Using Parsed Transfer Fields

Using Parsed Approval Fields

Using Function Name and Category Placeholders

Using Function Category Placeholders

Using Event Category Placeholders

Using Swap Event Category Placeholders

Best Practices

  1. Use %tx.value_eth for human-readable amounts instead of %tx.value (which shows raw wei)
  2. Include transaction hash (%tx.hash) for easy lookup on block explorers
  3. Format consistently - numeric placeholders are already formatted, don’t add extra formatting

Next Steps

Fields

Learn about transaction fields available in conditions

Examples

See complete rule examples using placeholders

Structure

Learn about rule structure

Test Rules

Test your rules with blocklight dry-run