Transactions Monitoring
Overview
The Realtime API is a stateful, event-based API that communicates over a WebSocket. The WebSocket connection requires the following parameters:
- URL:
wss://api.bmining.pro/v1/transactions
- Headers:
Authorization: Bearer YOUR_API_KEY
Field | Type | Description |
---|---|---|
chain | String | Optional. The blockchain to monitor. |
tag | String | Optional. The tag to monitor. |
address | String | Optional. The address to monitor. |
Below is a simple example using the popular ws
library in Node.js to establish a socket connection, send a message from the client, and receive a response from the server. It requires that a valid API_KEY
is exported in the system environment.
import WebSocket from "ws";
const url = "wss://api.bmining.pro/v1/transactions?chain=bitcoin&tag=satoshi";
const ws = new WebSocket(url, {
headers: {
"Authorization": "Bearer " + process.env.API_KEY,
},
});
ws.on("message", (message) => {
console.log(JSON.parse(message.toString()));
});
Example
{
"id": "cm36lv37lums610cmaujehor2",
"chain": "bitcoin",
"token_address": "0",
"from_address": "0",
"to_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
"value": "5000000000",
"tx_hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
"block_number": 0,
"block_hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"block_time": "2009-01-04T02:15:05.000Z"
}