Stream Transaction

Stream transactions will help you to track the activity of the subscribed address on the blockchain.

Response Schema:



Hash of the block.


Number of the block.


0x1 denotes ethereum.


Ethereum address of the sender of the transaction.


Gas provided by the sender.


Amount of Ether that the sender is willing to pay for each unit of gas.


Hash of the transaction.


The data sent along with the transaction.


Unique value that is incremented with each transaction and is unique to each account.


Signature values that are used to verify the transaction's authenticity.


Ethereum address of the recipient of the transaction.


Integer of the transactions index position in the block.


Type of transaction.


Amount of Ether to be transferred in the transaction.

Streaming transactions:

Users can stream transactions in two ways:

Example 1: via wscat script (For Linux based distro)

First, the user needs to run the following command in their terminal to install wscat in their system:

npm install -g wscat 

After installing wscat, the user needs to create a shell script and paste the following sample code:

Client Side Sample Socket Code :


echo "Price Discovery\n"
read -p "x-api-key: " YOUR_API_KEY
wscat -c wss:// -H authorization:secret-token -H x-api-key:$YOUR_API_KEY

Once the file has been saved, the user will need to grant permission for it to be executed. This can be accomplished by executing the following command:

chmod +x

After following the above steps, the user needs to run the file. This can be done by entering the filename in the console.

Executing a query:

After executing the aforementioned file(shell script), the user will be prompted to input the appropriate API key.

After entering the API key, user can subscribe to following actions:

{"action": "streamTransactions"}

Make sure you are connected to the WebSocket before you perform the following queries.

Applying a filter in the query:

Users can apply the following filters in their query:-

  • addresses

  • minAmount(Wei)

  • maxAmount(Wei)

The above filters can be applied in any combination, using the following syntax:

{"action": "streamTransactions", "addresses": "array_of_strings", "minAmount": "minimum_amount_in_wei", "maxAmount": "maximum_amount_in_wei"}

Sample Query:

{"action": "streamTransactions", "addresses": ["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D","0xdafea492d9c6733ae3d56b7ed1adb60692c98bc5"], "minAmount": "0", "maxAmount": "1000000000000000000000000000000000000"}

Example 2. via javascript code

First, the user needs to run the following command in their terminal to install wscat in their system:

npm i ws

After installing ws, the user needs to run the following sample code on their device to start streaming:

Client Side Sample Socket Code :

const WebSocket = require('ws');
const url = 'wss://';
const options = {
  headers: {
    Authorization: 'secret-token',
    'x-api-key': 'YOUR_API_KEY', // Replace this with your API Key

const ws = new WebSocket(url, options);

ws.on('open', () => {
  console.log('WebSocket connection established.');
  const payload = {
    action: "streamTransactions",
    addresses: ["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D","0xdafea492d9c6733ae3d56b7ed1adb60692c98bc5"],
    minAmount: "0",
    maxAmount: "10000000000000000000000000000000000000000000"

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

ws.on('close', () => {
  console.log('WebSocket connection closed.');

The payload can be modified, depending on the action.

Expected Output:

  "blockHash": "0x528f4648ffd86cf89f0bd331cdad2185193bedf183c239235c3a84e83f9aa03c",
  "blockNumber": 16461655,
  "chainId": "0x1",
  "from": "0x27E1D375B3Bed078EcA97a5132A8e702ff222528",
  "gas": 502594,
  "gasPrice": "17409031646",
  "hash": "0x0d1775fc18e65485aced1ccbcdb333ef7a16f2312198e68a553452b957957379",
  "input": "0x791ac9470000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000000000000000000000000000057a67078b9a31b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000027e1d375b3bed078eca97a5132a8e702ff2225280000000000000000000000000000000000000000000000000000000063cd0c0e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000077c67b8401d8dca854a3a0929c85ed030b76f670000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "nonce": 24,
  "r": "0x7052bbb63c73c3447ebef1649e89e0ed4659aeedddda1cfedb00cbd63b737a7d",
  "s": "0x4f9bfa47d1f958b0673d574012e1b202a7aa4092b77d0fa756a3611290d9eca9",
  "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
  "transactionIndex": 6,
  "type": 2,
  "v": "0x1",
  "value": "0"

How to disconnect:

To disconnect from our API, enter ctrl-c in the connected console.

Last updated