SUBSCRIBE_TXS

Subscribing to Real-Time Token Transaction Updates (SUBSCRIBE_TXS)

The "SUBSCRIBE_TXS" event allows you to receive real-time updates about token transactions. You can subscribe to transactions for individual tokens, token pairs, or a combination of both. This subscription is useful for tracking trading activities, transfers, and other relevant transactions on the Birdeye platform.

You can use this Websocket to get real time transaction updates of following objects:

  • Transactions (trades) of a token
  • Transactions (trades) of a pair/market
  • Transactions (trades) of multiple Tokens/Pairs

The instructions for each type of objects are described below.

Code Example

Checkout this Github file for an example:

https://github.com/birdeye-so/tradingview-example-js-api/blob/main/websocket_example.js

1 - Subscribe Token Transactions

To receive real-time updates about transactions for a specific token, you can use the following subscription message format:

Input

{
    "type": "SUBSCRIBE_TXS",
    "data": {
        "queryType": "simple",
        "address": "So11111111111111111111111111111111111111112"
    }
}

Output Example

{
  "blockUnixTime": 1675620000,
  "owner": "MeowujaCA1FGaA7hna2ezUXLbrj36qZi4hGx94xNQLo",
  "source": "raydium",
  "txHash": "5zXXgqYaXe6Dn6xkVSzui5rTTz1f8dWmFkxNXTLYVu8H3FDgf2xAxtWQz7XYpcZV21mhncrkkfgGBXrSP9KKHpCK",
  "side": "buy",
  "tokenAddress": "So11111111111111111111111111111111111111112",
  "alias": null,
  "isTradeOnBe": false,
  "platform": "slowprotocol",
  "volumeUSD": 0.05237464631298352,
  "from": {
    "symbol": "SLOW",
    "decimals": 5,
    ...
  },
  "to": {
    "symbol": "SOL",
    "decimals": 9,
    ...
  },
  "tokenPrice": null
}

2 - Subscribe Pair Transactions

To receive real-time updates about transactions for a specific token pair, you can use the following subscription message format:

Input

{
    "type": "SUBSCRIBE_TXS",
    "data": {
        "queryType": "simple",
        "pairAddress": "FmKAfMMnxRMaqG1c4emgA4AhaThi4LQ4m2A12hwoTibb"
    }
}

Output Example

{
  "type": "TXS_DATA",
  "data": {
    "blockUnixTime": 1675507116,
    "owner": "MeowujaCA1FGaA7hna2ezUXLbrj36qZi4hGx94xNQLo",
    "source": "raydium",
    "txHash": "2ZMUbubtyFWKdP3S9f2BP2BkSns44y2pC6VZ1RzQMMknLaDfcq6YFdb2BCYqNmGM2ZrBjiGT1dVLDsUJZtBEkPZg",
    "alias": null,
    "isTradeOnBe": false,
    "platform": "slowprotocol",
    "volumeUSD": 0.05390526619315549,
    "from": {
      "symbol": "SLOW",
      "decimals": 5,
      ...
    },
    "to": {
      "symbol": "mSOL",
      "decimals": 9,
      ...
    }
  }
}

3 - Subscribe to Multiple Addresses (Limit 100)

You can also subscribe to transactions for multiple addresses by using the "complex" query type.

You can get updates for maximum 100 addresses at once.

The following example demonstrates how to subscribe to transactions for either a specific token address or a specific token pair address:

Input

{
    "type": "SUBSCRIBE_TXS",
    "data": {
        "queryType": "complex",
        "query": "address = So11111111111111111111111111111111111111112 OR pairAddress = FmKAfMMnxRMaqG1c4emgA4AhaThi4LQ4m2A12hwoTibb"
    }
}

Output

{
    "type": "TXS_DATA",
    "data": {
        "blockUnixTime": 1692205532,
        "owner": "EkZStqj9BSwLS19uLDEsErCW6N1HHzvoGg92Ei3YYBNt",
        "source": "marinade",
        "txHash": "3GqVQTaimS2QsprgjTvpV4ArdZGUjoiacDE5Hy3baLapvAXekya7EsNjhWvMVbqdMRaJanwwAd4Bi9h8ag58vK3",
        ...
    }
}