Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}No examples foundNo examples found{
"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>"
}
}Primitives
Transactions
Subscribe to real-time canonical transactions with execution metadata and gas accounting.
WSS
/
Overview
- Dataset ID:
0102 - Transactions - Description: Transactions included in blocks.
- Sample: Hugging Face Sample
Subscription Parameters
Filter by sender address (20 bytes, hex string, no
0x prefix).Filter by recipient address (20 bytes, hex string, no
0x prefix).Filter by execution status (
true = success, false = revert).Message Fields
Keccak-256 hash of the transaction (hex string, 32 bytes, no
0x prefix).Block height containing the transaction.
UTC timestamp of the block (ISO-8601).
Zero-based index of the transaction within the block.
Sender address (hex string, 20 bytes, no
0x prefix).Recipient address (hex string, 20 bytes, no
0x prefix). null for contract creation.Address of the contract created by this transaction.
null for non-creation transactions.Gas consumed by the transaction (string to preserve
NUMERIC(78) precision).Effective gas price paid in wei (string to preserve
NUMERIC(78) precision).Execution status:
true = success, false = revert, null for pre-Byzantium blocks.Pre-Byzantium: state root after tx execution;
null for Byzantium+.Transaction type identifier (e.g.,
2 = EIP-1559, 1 = legacy).true if trace failed, false if trace succeeded, null if trace not available.Value transferred in wei (string to preserve
NUMERIC precision).Calldata sent with the transaction (hex string, no
0x prefix).Sender nonce.
Gas limit provided by the sender (string to preserve
NUMERIC precision).Gas price in wei (legacy, string to preserve
NUMERIC precision).Max fee per gas in wei (EIP-1559, string to preserve
NUMERIC precision).Max priority fee per gas in wei (EIP-1559, string to preserve
NUMERIC precision).Tracing identifier for cross-referencing with other datasets.
Record creation timestamp.
Record last update timestamp.
Subscription Example
# 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}}'
#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;
}
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));
}
}
}
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()
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));
});
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)
}
}
Response Example
{
"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"
}
}
Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}No examples foundNo examples found{
"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>"
}
}subscribe
type:object
unsubscribe
type:object
subscribe_response
type:object
unsubscribe_response
type:object
update
type:object
Last modified on April 6, 2026
Was this page helpful?
⌘I