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": "842NwDnKYcfMRWAYqsD3hoTWXKKMi28gVABtmaupFcnS"
    }
}

Output Example

 type: 'TXS_DATA',
  data: {
    blockUnixTime: 1714107255,
    owner: 'TyrZ6SDVQGdMpnYtAgKGocvi1w1mdffhZENf1knyeqy',
    source: 'raydium',
    txHash: '3XtCydTzZPJNGr9qQ83rvkKyGQHMQcUa3QpgBZoz97i3VkRGL3e8UBhM7JUnprwbcgWXeHXST74NeaEE4vjWeEME',
    alias: null,
    isTradeOnBe: false,
    platform: 'YmirFH6wUrtUMUmfRPZE7TcnszDw689YNWYrMgyB55N',
    volumeUSD: 31.569239727896086,
    from: {
      symbol: 'SOL',
      decimals: 9,
      address: 'So11111111111111111111111111111111111111112',
      amount: 219852856,
      type: 'transfer',
      typeSwap: 'from',
      uiAmount: 0.219852856,
      price: null,
      nearestPrice: 143.5925841595439,
      changeAmount: -219852856,
      uiChangeAmount: -0.219852856,
      icon: null
    },
    to: {
      symbol: 'TOM',
      decimals: 9,
      address: '2rJSfgxoWP7h3rw3hDUF7HPToY3exb6FdH9xFBg7TeQk',
      amount: 650244687263,
      type: 'transfer',
      typeSwap: 'to',
      feeInfo: null,
      uiAmount: 650.244687263,
      price: 0.048549784944459676,
      nearestPrice: 0.048420900217275124,
      changeAmount: 650244687263,
      uiChangeAmount: 650.244687263,
      icon: null
    }
  }
}

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",
        ...
    }
}