Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>",
"status": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"severity": "<string>",
"retryable": true
}
}{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>",
"status": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"severity": "<string>",
"retryable": true
}
}{
"chain_id": 123,
"dataset_id": "<string>",
"is_reorg": true,
"data": {
"pool_uid": "<string>",
"token": "<string>",
"amount_borrowed": "<string>",
"amount_repaid": "<string>",
"block_number": 123,
"_tracing_id": "<string>"
}
}Flash loans
Flash Loan Prints
Subscribe to flash loan borrow/repay events.
WSS
/
Overview
- Dataset ID:
0305 - Flash Loan Prints - Description: One row per borrowed token per on-chain flash loan event (V2-style flash swap, V3 Flash event, Balancer V2 Vault, etc.).
pool_uidis NULL for vault-level events not tied to a single pool. - Sample: Hugging Face Sample
Subscription Parameters
string[]
Optional filters: pool UIDs (32-byte hex, no
0x prefix).string[]
Optional filters: emitter contracts (pool or vault), 20-byte hex without
0x.string[]
Optional filters: borrowed token addresses (hex, no
0x).Message Fields
string | null
Pool id when pool-scoped; null for vault-level events.
number | null
Exchange identifier when pool-scoped.
number | null
Pool type identifier when pool-scoped.
string
Address of the contract that emitted the event (hex).
string
Borrowed token address (hex).
string
Raw borrowed amount (decimal string).
string
Raw repaid amount (decimal string).
string
Raw fee paid:
amount_repaid − amount_borrowed (decimal string).number
Event block.
string
Block time (ISO-8601).
number
Transaction index.
number
Log index.
string
Lineage id (hex).
string[]
Parent lineage ids (hex).
string
Record creation time (ISO-8601).
string
Record last update time (ISO-8601).
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": "0305", "chain_id": 1, "params": {}}'
#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 + 1024];
unsigned char *p = &buf[LWS_PRE];
size_t n = sprintf((char *)p, "{\"action\": \"subscribe\", \"dataset_id\": \"0305\", \"chain_id\": 1, \"params\": {}}");
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\": \"0305\", \"chain_id\": 1, \"params\": {}}";
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": "0305",
"chain_id": 1,
"params": {}
}
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: '0305',
chain_id: 1,
params: {}
}));
});
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": "0305", "chain_id": 1, "params": {}}`
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": "0305",
"is_reorg": false,
"data": {
"block_number": 19000050,
"block_time": "2025-11-11T10:00:00Z",
"tx_index": 12,
"log_index": 3,
"pool_uid": "00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"exchange_id": 3,
"type_id": 302,
"flash_loan_source": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount_borrowed": "1000000000000000000",
"amount_repaid": "1003000000000000000",
"fee_amount": "3000000000000000",
"_tracing_id": "030500000000000000000000000000007401",
"_parent_tracing_ids": ["010300000000000000000000000000007401"],
"_created_at": "2025-11-11T10:00:05Z",
"_updated_at": "2025-11-11T10:00:05Z"
}
}
Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>",
"status": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"severity": "<string>",
"retryable": true
}
}{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>",
"status": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"severity": "<string>",
"retryable": true
}
}{
"chain_id": 123,
"dataset_id": "<string>",
"is_reorg": true,
"data": {
"pool_uid": "<string>",
"token": "<string>",
"amount_borrowed": "<string>",
"amount_repaid": "<string>",
"block_number": 123,
"_tracing_id": "<string>"
}
}subscribe
type:object
unsubscribe
type:object
subscribe_response
type:object
unsubscribe_response
type:object
update
type:object
Last modified on July 19, 2026
Was this page helpful?
⌘I