newMinedTransactions - EVM Data Stream

The newMinedTransactions topic sends one notification per transaction included in a new block, either as the full transaction object or as its hash only. Address rules let you receive just the transactions of the wallets or contracts you care about.

WebSocket-only topic. Subscribe with getblock_subscribe on any network endpoint.

Parameters

ParameterTypeRequiredDescription
hashesOnlybooleanNotrue to receive only the transaction hash. Default false: the full transaction object.
addressesarrayNoUp to 50 match rules, each { "from": "0x…", "to": "0x…" } with at least one of the two set.

These fields sit at the top level of the request object, next to topic, not inside filters.

How addresses rules combine: fields inside one rule are AND, and separate rules are OR.

json"addresses": [
  { "from": "0xA…", "to": "0xB…" },
  { "to": "0xC…" }
]

This matches transactions sent from 0xA… to 0xB…, plus every transaction sent to 0xC…. Omit addresses to receive every transaction in every block.

Request Example

bash# WebSocket-only. Connect first:
wscat -c 'wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream' -H 'Authorization: Bearer <API-KEY>'

# Then send:
{"jsonrpc":"2.0","id":1,"method":"getblock_subscribe","params":[{"topic":"newMinedTransactions","hashesOnly":false,"addresses":[{"to":"0xdAC17F958D2ee523a2206206994597C13D831ec7"}]}]}
javascript// npm install ws
import WebSocket from 'ws';

const ws = new WebSocket('wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream', {
  headers: { Authorization: 'Bearer <API-KEY>' }
});

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getblock_subscribe',
    params: [{
      topic: 'newMinedTransactions',
      hashesOnly: false,
      addresses: [
        {
          to: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
        }
      ]
    }]
  }));
});

ws.on('message', (raw) => {
  const msg = JSON.parse(raw);

  // First reply is the subscription ID (or an error)
  if (msg.id !== undefined) {
    console.log(msg.error ?? `Subscribed: ${msg.result}`);
    return;
  }

  const { removed, data } = msg.params.result;
  const tx = data.transaction;
  console.log(removed ? 'REVERTED' : 'mined', tx.hash, 'block', parseInt(tx.blockNumber, 16));
});
python# pip install "websockets>=14"
import asyncio, json, websockets

URL = "wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream"
HEADERS = {"Authorization": "Bearer <API-KEY>"}

async def main():
    # ping_interval=None: the server sends its own keepalive pings (see Connection keepalive)
    async with websockets.connect(URL, additional_headers=HEADERS, ping_interval=None) as ws:
        await ws.send(json.dumps({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getblock_subscribe",
            "params": [{
                "topic": "newMinedTransactions",
                "hashesOnly": False,
                "addresses": [
                    {
                        "to": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
                    }
                ]
            }]
        }))

        async for message in ws:
            msg = json.loads(message)

            # First reply is the subscription ID (or an error)
            if "id" in msg:
                print(msg.get("error") or f"Subscribed: {msg['result']}")
                continue

            event = msg["params"]["result"]
            removed, data = event["removed"], event["data"]
            tx = data['transaction']
            print('REVERTED' if removed else 'mined', tx['hash'], 'block', int(tx['blockNumber'], 16))

asyncio.run(main())

Response Example

The first reply is the subscription ID:

json{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x09e2b35d6f3a73734f8e162b2aca6991"
}

Every later message is an event notification:

json{
  "jsonrpc": "2.0",
  "method": "getblock_subscribe",
  "params": {
    "subscription": "0x09e2b35d6f3a73734f8e162b2aca6991",
    "result": {
      "eventId": "eth:mainnet:block:0x19ddc6864bd5ec1cdbd493e3d3653b529d79293a677351…",
      "removed": false,
      "revision": 116876399,
      "data": {
        "removed": false,
        "transaction": {
          "blockHash": "0x19ddc6864bd5ec1cdbd493e3d3653b529d79293a6773517018153cdff6ac0be2",
          "blockNumber": "0x18d1e1e",
          "blockTimestamp": "0x6ab110c3",
          "from": "0x4b3dd3690ba06b2a73089e02381d0eba9a7dbca5",
          "gas": "0xb435",
          "gasPrice": "0x90411020",
          "maxFeePerGas": "0x919e1a15",
          "maxPriorityFeePerGas": "0x77359400",
          "hash": "0x6b362543c83c1d18b27701235338c05a7e04c2e5098bed46d60afe9a0f17d2a1",
          "input": "0xa9059cbb000000000000000000000000a2050435e59f41300b7787808e976255faa198e50000000000000000000000000000000000000000000000000000000006f4b360",
          "nonce": "0x0",
          "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
          "transactionIndex": "0x3",
          "value": "0x0",
          "type": "0x2",
          "accessList": [],
          "chainId": "0x1",
          "v": "0x1",
          "r": "0x5c77a499118778830cb1b24a41b6c9a83b191f310f96759cf91f220557baa58f",
          "s": "0x34bc833d1d7e796b12a577978f589ec06e22781cc6e71d1245c566c5506e8276",
          "yParity": "0x1"
        }
      }
    }
  }
}

With "hashesOnly": true, transaction holds only the hash:

json{
  "data": {
    "removed": false,
    "transaction": {
      "hash": "0x9b4585ad4e6af637077628e2c43196fb91b8318758ae3a4409b61b6c7c325833"
    }
  }
}

Response Parameters

The result object contains the event envelope and the payload in data.

FieldTypeDescription
eventIdstringStable event identifier. A reorg correction reuses it.
removedbooleantrue when a reorg removed this previously delivered event.
revisionnumberEvent version. For one eventId, a greater revision is newer.
data.removedbooleanMirrors the envelope's removed. Use the envelope field for reorg handling.
data.transactionobjectThe transaction, in the same shape as eth_getTransactionByHash. With hashesOnly, only hash.
data.transaction.hashstringTransaction hash.
data.transaction.blockHashstringHash of the block that included the transaction.
data.transaction.blockNumberstringBlock number, hex-encoded.
data.transaction.blockTimestampstringBlock timestamp in Unix seconds, hex-encoded.
data.transaction.transactionIndexstringTransaction's position in the block, hex-encoded.
data.transaction.fromstringSender.
data.transaction.tostringRecipient. null for contract creation.
data.transaction.valuestringNative value transferred in wei, hex-encoded.
data.transaction.inputstringCall data.
data.transaction.noncestringSender nonce, hex-encoded.
data.transaction.gasstringGas limit, hex-encoded.
data.transaction.gasPricestringEffective gas price in wei, hex-encoded.
data.transaction.maxFeePerGasstringEIP-1559 max fee per gas, on type 0x2 and later.
data.transaction.maxPriorityFeePerGasstringEIP-1559 priority fee per gas, on type 0x2 and later.
data.transaction.typestringEIP-2718 transaction type, hex-encoded.
data.transaction.chainIdstringChain ID, hex-encoded.
data.transaction.accessListarrayEIP-2930 access list, on type 0x1 and later.
data.transaction.v, r, s, yParitystringSignature values.

Inclusion is not execution success: a mined transaction can still have reverted. To learn the outcome, use transactionReceipts.

Use Cases

  • Confirming that a broadcast transaction was included in a block
  • Wallet activity feeds for a set of up to 50 addresses
  • Watching every call to a contract ({ "to": contract })
  • Pairing with newPendingTransactions to measure mempool-to-block latency

Error Handling

CodeMessageCause
-32602addresses[N] requires from or toAn addresses rule is empty.
-32602invalid addresses[N].to: invalid EVM address "…"An address in a rule is not a 20-byte hex address.
-32602invalid newMinedTransactions request: json: unknown field "filters"The fields were nested in filters. Put hashesOnly and addresses at the top level.
-32602invalid newMinedTransactions request: json: unknown field "…"The request has a field this topic does not accept.
-32001subscription limit exceededYou already have 15 active or pending subscriptions.