> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockdb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Transactions

> Subscribe to real-time canonical transactions with execution metadata and gas accounting.

## Overview

* **Dataset ID:** [`0102 - Transactions`](/data-catalog/evm/primitives/transactions)
* **Description:** Transactions included in blocks.
* **Sample:** [Hugging Face Sample](https://huggingface.co/datasets/BlockDB/Raw-Transactions-Ethereum-And-EVM-Cryptocurrency-Data)

## Subscription Parameters

<ParamField body="chain_id" type="number" required>
  Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.*
</ParamField>

<ParamField body="from_addresses" type="string[]">
  Filter by sender address (20 bytes, hex string, no `0x` prefix).
</ParamField>

<ParamField body="to_addresses" type="string[]">
  Filter by recipient address (20 bytes, hex string, no `0x` prefix).
</ParamField>

<ParamField body="status_success" type="boolean">
  Filter by execution status (`true` = success, `false` = revert).
</ParamField>

## Message Fields

<ResponseField name="tx_hash" type="string">
  Keccak-256 hash of the transaction (hex string, 32 bytes, no `0x` prefix).
</ResponseField>

<ResponseField name="block_number" type="number">
  Block height containing the transaction.
</ResponseField>

<ResponseField name="block_time" type="string">
  UTC timestamp of the block (ISO-8601).
</ResponseField>

<ResponseField name="tx_index" type="number">
  Zero-based index of the transaction within the block.
</ResponseField>

<ResponseField name="from_address" type="string">
  Sender address (hex string, 20 bytes, no `0x` prefix).
</ResponseField>

<ResponseField name="to_address" type="string | null">
  Recipient address (hex string, 20 bytes, no `0x` prefix). `null` for contract creation.
</ResponseField>

<ResponseField name="created_contract_address" type="string | null">
  Address of the contract created by this transaction. `null` for non-creation transactions.
</ResponseField>

<ResponseField name="gas_used" type="string">
  Gas consumed by the transaction (string to preserve `NUMERIC(78)` precision).
</ResponseField>

<ResponseField name="effective_gas_price_wei" type="string">
  Effective gas price paid in wei (string to preserve `NUMERIC(78)` precision).
</ResponseField>

<ResponseField name="status_success" type="boolean">
  Execution status: `true` = success, `false` = revert, `null` for pre-Byzantium blocks.
</ResponseField>

<ResponseField name="root" type="string | null">
  Pre-Byzantium: state root after tx execution; `null` for Byzantium+.
</ResponseField>

<ResponseField name="tx_type" type="number">
  Transaction type identifier (e.g., `2` = EIP-1559, `1` = legacy).
</ResponseField>

<ResponseField name="trace_failed" type="boolean | null">
  `true` if trace failed, `false` if trace succeeded, `null` if trace not available.
</ResponseField>

<ResponseField name="value_wei" type="string">
  Value transferred in wei (string to preserve `NUMERIC` precision).
</ResponseField>

<ResponseField name="input" type="string">
  Calldata sent with the transaction (hex string, no `0x` prefix).
</ResponseField>

<ResponseField name="nonce" type="number">
  Sender nonce.
</ResponseField>

<ResponseField name="gas_limit" type="string">
  Gas limit provided by the sender (string to preserve `NUMERIC` precision).
</ResponseField>

<ResponseField name="gas_price_wei" type="string">
  Gas price in wei (legacy, string to preserve `NUMERIC` precision).
</ResponseField>

<ResponseField name="max_fee_per_gas_wei" type="string">
  Max fee per gas in wei (EIP-1559, string to preserve `NUMERIC` precision).
</ResponseField>

<ResponseField name="max_priority_fee_per_gas_wei" type="string">
  Max priority fee per gas in wei (EIP-1559, string to preserve `NUMERIC` precision).
</ResponseField>

<ResponseField name="_tracing_id" type="string">
  Tracing identifier for cross-referencing with other datasets.
</ResponseField>

<ResponseField name="_created_at" type="string">
  Record creation timestamp.
</ResponseField>

<ResponseField name="_updated_at" type="string">
  Record last update timestamp.
</ResponseField>

## Subscription Example

<CodeGroup>
  ```bash bash theme={null}
  # Use wscat to connect and subscribe
  wscat -c wss://api.blockdb.io/v1/evm/ \
    -H "Authorization: Bearer $BLOCKDB_API_KEY" \
    -x '{"action": "subscribe", "dataset_id": "0102", "chain_id": 1, "params": {"status_success": true}}'
  ```

  ```c C theme={null}
  #include <libwebsockets.h>
  #include <string.h>
  #include <stdio.h>

  static int callback_blockdb(struct lws *wsi, enum lws_callback_reasons reason,
                              void *user, void *in, size_t len) {
      switch (reason) {
          case LWS_CALLBACK_CLIENT_ESTABLISHED:
              lws_callback_on_writable(wsi);
              break;
          case LWS_CALLBACK_CLIENT_RECEIVE:
              printf("Received: %s\n", (char *)in);
              break;
          case LWS_CALLBACK_CLIENT_WRITEABLE: {
              unsigned char buf[LWS_PRE + 512];
              unsigned char *p = &buf[LWS_PRE];
              size_t n = sprintf((char *)p, "{\"action\": \"subscribe\", \"dataset_id\": \"0102\", \"chain_id\": 1, \"params\": {\"status_success\": true}}");
              lws_write(wsi, p, n, LWS_WRITE_TEXT);
              break;
          }
      }
      return 0;
  }
  ```

  ```csharp .NET theme={null}
  using System;
  using System.Net.WebSockets;
  using System.Text;
  using System.Threading;
  using System.Threading.Tasks;

  class Program {
      static async Task Main() {
          using var ws = new ClientWebSocket();
          ws.Options.SetRequestHeader("Authorization", $"Bearer {Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")}");
          await ws.ConnectAsync(new Uri("wss://api.blockdb.io/v1/evm/"), CancellationToken.None);

          var subMsg = "{\"action\": \"subscribe\", \"dataset_id\": \"0102\", \"chain_id\": 1, \"params\": {\"status_success\": true}}";
          await ws.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(subMsg)), WebSocketMessageType.Text, true, CancellationToken.None);

          var buffer = new byte[1024 * 4];
          while (ws.State == WebSocketState.Open) {
              var result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
              Console.WriteLine(Encoding.UTF8.GetString(buffer, 0, result.Count));
          }
      }
  }
  ```

  ```python Python theme={null}
  import websocket
  import json
  import os

  def on_message(ws, message):
      print(f"Received: {message}")

  def on_open(ws):
      msg = {
          "action": "subscribe",
          "dataset_id": "0102",
          "chain_id": 1,
          "params": {"status_success": True}
      }
      ws.send(json.dumps(msg))

  ws = websocket.WebSocketApp(
      "wss://api.blockdb.io/v1/evm/",
      header={"Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}"},
      on_message=on_message,
      on_open=on_open
  )
  ws.run_forever()
  ```

  ```javascript Node.js theme={null}
  const WebSocket = require('ws');

  const ws = new WebSocket('wss://api.blockdb.io/v1/evm/', {
    headers: { 'Authorization': `Bearer ${process.env.BLOCKDB_API_KEY}` }
  });

  ws.on('open', () => {
    ws.send(JSON.stringify({
      action: 'subscribe',
      dataset_id: '0102',
      chain_id: 1,
      params: { status_success: true }
    }));
  });

  ws.on('message', (data) => {
    console.log('Received:', JSON.parse(data));
  });
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"log"
  	"net/http"
  	"os"
  	"github.com/gorilla/websocket"
  )

  func main() {
  	header := http.Header{"Authorization": []string{"Bearer " + os.Getenv("BLOCKDB_API_KEY")}}
  	c, _, err := websocket.DefaultDialer.Dial("wss://api.blockdb.io/v1/evm/", header)
  	if err != nil {
  		log.Fatal("dial:", err)
  	}
  	defer c.Close()

  	sub := `{"action": "subscribe", "dataset_id": "0102", "chain_id": 1, "params": {"status_success": true}}`
  	err = c.WriteMessage(websocket.TextMessage, []byte(sub))
  	if err != nil {
  		log.Fatal("write:", err)
  	}

  	for {
  		_, message, err := c.ReadMessage()
  		if err != nil {
  			log.Fatal("read:", err)
  		}
  		fmt.Printf("Received: %s\n", message)
  	}
  }
  ```
</CodeGroup>

## Response Example

<CodeGroup>
  ```json Response theme={null}
  {
    "chain_id": 1,
    "dataset_id": "0102",
    "is_reorg": false,
    "data": {
      "block_number": 12345678,
      "block_time": "2025-11-11T18:42:15.123Z",
      "tx_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0",
      "tx_index": 4,
      "from_address": "0000000000000000000000000000000000000000",
      "to_address": "0000000000000000000000000000000000000001",
      "created_contract_address": null,
      "gas_used": "21000",
      "effective_gas_price_wei": "1234567890123456789",
      "status_success": true,
      "root": null,
      "tx_type": 2,
      "trace_failed": null,
      "value_wei": "0",
      "input": "",
      "nonce": 1,
      "gas_limit": "21000",
      "gas_price_wei": "1234567890123456789",
      "max_fee_per_gas_wei": "0",
      "max_priority_fee_per_gas_wei": "0",
      "_tracing_id": "010200000000000000000000000000000000",
      "_created_at": "2025-11-11T18:42:15.123Z",
      "_updated_at": "2025-11-11T18:42:15.123Z"
    }
  }
  ```
</CodeGroup>


## AsyncAPI

````yaml specs/wss/evm/primitives/transactions.yaml transactions
id: transactions
title: Transactions
description: ''
servers:
  - id: production
    protocol: wss
    host: api.blockdb.io/v1/evm/
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_2
    id: onSubscribe
    title: On subscribe
    type: receive
    messages:
      - &ref_5
        id: subscribe
        payload:
          - name: subscribe
            type: object
            properties:
              - name: action
                type: string
                description: subscribe
                required: true
              - name: chain_id
                type: integer
                required: true
              - name: dataset_id
                type: string
                description: '0102'
                required: true
              - name: params
                type: object
                required: true
                properties:
                  - name: from_addresses
                    type: array
                    required: false
                    properties:
                      - name: item
                        type: string
                        required: false
                  - name: to_addresses
                    type: array
                    required: false
                    properties:
                      - name: item
                        type: string
                        required: false
                  - name: status_success
                    type: boolean
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            action:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-2>
            chain_id:
              type: integer
              x-parser-schema-id: <anonymous-schema-3>
            dataset_id:
              type: string
              const: '0102'
              x-parser-schema-id: <anonymous-schema-4>
            params:
              type: object
              properties:
                from_addresses:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-7>
                  x-parser-schema-id: <anonymous-schema-6>
                to_addresses:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-9>
                  x-parser-schema-id: <anonymous-schema-8>
                status_success:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-10>
              x-parser-schema-id: <anonymous-schema-5>
          required:
            - action
            - chain_id
            - dataset_id
            - params
          x-parser-schema-id: <anonymous-schema-1>
        title: Subscribe
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
          - id: x-parser-message-name
            value: subscribe
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: transactions
  - &ref_3
    id: onUnsubscribe
    title: On unsubscribe
    type: receive
    messages:
      - &ref_6
        id: unsubscribe
        payload:
          - name: unsubscribe
            type: object
            properties:
              - name: action
                type: string
                description: unsubscribe
                required: true
              - name: chain_id
                type: integer
                required: true
              - name: dataset_id
                type: string
                description: '0102'
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            action:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-12>
            chain_id:
              type: integer
              x-parser-schema-id: <anonymous-schema-13>
            dataset_id:
              type: string
              const: '0102'
              x-parser-schema-id: <anonymous-schema-14>
          required:
            - action
            - chain_id
            - dataset_id
          x-parser-schema-id: <anonymous-schema-11>
        title: Unsubscribe
        example: |-
          {
            "action": "<string>",
            "chain_id": 123,
            "dataset_id": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribe
          - id: x-parser-message-name
            value: unsubscribe
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: emitUpdates
    title: Emit updates
    type: send
    messages:
      - &ref_7
        id: subscribe_response
        payload:
          - name: subscribe_response
            type: object
            properties:
              - name: action
                type: string
                description: subscribe
                required: true
              - name: chain_id
                type: integer
                required: true
              - name: dataset_id
                type: string
                description: '0102'
                required: true
              - name: status
                type: string
                enumValues:
                  - success
                  - error
                required: true
              - name: error
                type: object
                required: false
                properties:
                  - name: code
                    type: string
                    description: Machine-readable error code.
                    required: true
                  - name: message
                    type: string
                    description: Human-readable summary of the error.
                    required: true
                  - name: hint
                    type: string
                    description: Diagnostic hint to help resolve the issue.
                    required: false
                  - name: severity
                    type: string
                    enumValues:
                      - info
                      - warning
                      - error
                      - critical
                    required: true
                  - name: retryable
                    type: boolean
                    description: Whether the client should attempt to retry the operation.
                    required: true
                  - name: details
                    type: object
                    description: Additional structured metadata about the error.
                    required: false
                  - name: docs_url
                    type: string
                    description: Link to relevant documentation for the error.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            action:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-16>
            chain_id:
              type: integer
              x-parser-schema-id: <anonymous-schema-17>
            dataset_id:
              type: string
              const: '0102'
              x-parser-schema-id: <anonymous-schema-18>
            status:
              type: string
              enum:
                - success
                - error
              x-parser-schema-id: <anonymous-schema-19>
            error: &ref_1
              type: object
              properties:
                code:
                  type: string
                  description: Machine-readable error code.
                  x-parser-schema-id: <anonymous-schema-20>
                message:
                  type: string
                  description: Human-readable summary of the error.
                  x-parser-schema-id: <anonymous-schema-21>
                hint:
                  type: string
                  description: Diagnostic hint to help resolve the issue.
                  x-parser-schema-id: <anonymous-schema-22>
                severity:
                  type: string
                  enum:
                    - info
                    - warning
                    - error
                    - critical
                  x-parser-schema-id: <anonymous-schema-23>
                retryable:
                  type: boolean
                  description: Whether the client should attempt to retry the operation.
                  x-parser-schema-id: <anonymous-schema-24>
                details:
                  type: object
                  description: Additional structured metadata about the error.
                  x-parser-schema-id: <anonymous-schema-25>
                docs_url:
                  type: string
                  format: uri
                  description: Link to relevant documentation for the error.
                  x-parser-schema-id: <anonymous-schema-26>
              required:
                - code
                - message
                - severity
                - retryable
              x-parser-schema-id: ErrorObject
          required:
            - action
            - chain_id
            - dataset_id
            - status
          x-parser-schema-id: <anonymous-schema-15>
        title: Subscribe_response
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe_response
          - id: x-parser-message-name
            value: subscribe_response
      - &ref_8
        id: unsubscribe_response
        payload:
          - name: unsubscribe_response
            type: object
            properties:
              - name: action
                type: string
                description: unsubscribe
                required: true
              - name: chain_id
                type: integer
                required: true
              - name: dataset_id
                type: string
                description: '0102'
                required: true
              - name: status
                type: string
                enumValues:
                  - success
                  - error
                required: true
              - name: error
                type: object
                required: false
                properties:
                  - name: code
                    type: string
                    description: Machine-readable error code.
                    required: true
                  - name: message
                    type: string
                    description: Human-readable summary of the error.
                    required: true
                  - name: hint
                    type: string
                    description: Diagnostic hint to help resolve the issue.
                    required: false
                  - name: severity
                    type: string
                    enumValues:
                      - info
                      - warning
                      - error
                      - critical
                    required: true
                  - name: retryable
                    type: boolean
                    description: Whether the client should attempt to retry the operation.
                    required: true
                  - name: details
                    type: object
                    description: Additional structured metadata about the error.
                    required: false
                  - name: docs_url
                    type: string
                    description: Link to relevant documentation for the error.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            action:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-28>
            chain_id:
              type: integer
              x-parser-schema-id: <anonymous-schema-29>
            dataset_id:
              type: string
              const: '0102'
              x-parser-schema-id: <anonymous-schema-30>
            status:
              type: string
              enum:
                - success
                - error
              x-parser-schema-id: <anonymous-schema-31>
            error: *ref_1
          required:
            - action
            - chain_id
            - dataset_id
            - status
          x-parser-schema-id: <anonymous-schema-27>
        title: Unsubscribe_response
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribe_response
          - id: x-parser-message-name
            value: unsubscribe_response
      - &ref_9
        id: update
        payload:
          - name: update
            type: object
            properties:
              - name: chain_id
                type: integer
                required: true
              - name: dataset_id
                type: string
                description: '0102'
                required: true
              - name: is_reorg
                type: boolean
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: tx_hash
                    type: string
                    required: false
                  - name: block_number
                    type: integer
                    required: false
                  - name: from_address
                    type: string
                    required: false
                  - name: to_address
                    type: string
                    required: false
                  - name: gas_used
                    type: integer
                    required: false
                  - name: status_success
                    type: boolean
                    required: false
                  - name: _tracing_id
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            chain_id:
              type: integer
              x-parser-schema-id: <anonymous-schema-33>
            dataset_id:
              type: string
              const: '0102'
              x-parser-schema-id: <anonymous-schema-34>
            is_reorg:
              type: boolean
              x-parser-schema-id: <anonymous-schema-35>
            data:
              type: object
              properties:
                tx_hash:
                  type: string
                  x-parser-schema-id: <anonymous-schema-37>
                block_number:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-38>
                from_address:
                  type: string
                  x-parser-schema-id: <anonymous-schema-39>
                to_address:
                  type: string
                  x-parser-schema-id: <anonymous-schema-40>
                gas_used:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-41>
                status_success:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-42>
                _tracing_id:
                  type: string
                  x-parser-schema-id: <anonymous-schema-43>
              x-parser-schema-id: <anonymous-schema-36>
          required:
            - chain_id
            - dataset_id
            - is_reorg
            - data
          x-parser-schema-id: <anonymous-schema-32>
        title: Update
        example: |-
          {
            "chain_id": 123,
            "dataset_id": "<string>",
            "is_reorg": true,
            "data": {
              "tx_hash": "<string>",
              "block_number": 123,
              "from_address": "<string>",
              "to_address": "<string>",
              "gas_used": 123,
              "status_success": true,
              "_tracing_id": "<string>"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: update
          - id: x-parser-message-name
            value: update
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_2
  - *ref_3
receiveOperations:
  - *ref_4
sendMessages:
  - *ref_5
  - *ref_6
receiveMessages:
  - *ref_7
  - *ref_8
  - *ref_9
extensions:
  - id: x-parser-unique-object-id
    value: transactions
securitySchemes: []

````