WoC Sockets V2 (Beta)

New Block Header Event

Receive new block header events in real time.

URL

  • Mainnet: wss://socket-v2.whatsonchain.com/websocket/blockheaders

  • Testnet: wss://socket-v2-testnet.whatsonchain.com/websocket/blockheaders

Data JSON structure
{
  "channel": "woc:blockHeader",
  "pub": {
    "data": {
      "hash": "000000000000000007405fd882e9d4bf3d7b2388010081fe443ee1e323d8a668",
      "confirmations": 1,
      "size": 368170789,
      "height": 892466,
      "version": 939524096,
      "versionHex": "38000000",
      "merkleroot": "b0ac43a40a42775d8f533a8eda00bed3257e12a5fca3c8cade47188e6b7aa382",
      "txcount": 9230,
      "time": 1744648860,
      "mediantime": 1744645401,
      "nonce": 2893086732,
      "bits": "181246e3",
      "difficulty": 60157618395.71893,
      "chainwork": "00000000000000000000000000000000000000000164d487adbc2b84d47d2831",
      "previousblockhash": "0000000000000000090fa4de4c971b0b3609acc1061b2020d22dc8d8bf72746a",
      "nextblockhash": "",
      "coinbaseTx": {
        "hex": "...",
        "txid": "1932aa0229b6b44be4b749b9e7279c02136374e2e77b4e890db761f8e74d2111",
        "hash": "1932aa0229b6b44be4b749b9e7279c02136374e2e77b4e890db761f8e74d2111",
        "size": 111,
        "version": 1,
        "locktime": 0,
        "vin": [
          {
            "n": 0,
            "coinbase": "03329e0d2f7461616c2e636f6d2fb9df41e723a18d95e09d0200",
            "sequence": 4294967295
          }
        ],
        "vout": [
          {
            "value": 3.13276008,
            "n": 0,
            "scriptPubKey": {
              "asm": "OP_DUP OP_HASH160 522cf9e7626d9bd8729e5a1398ece40dad1b6a2f OP_EQUALVERIFY OP_CHECKSIG",
              "hex": "...",
              "reqSigs": 1,
              "type": "pubkeyhash",
              "addresses": [
                "18VWHjMt4ixHddPPbs6righWTs3Sg2QNcn"
              ],
              "isTruncated": false
            },
            "scripthash": "1981f116576960fab6ac9a71ba3c12e4f98c2d9b34532bdb40f2e8cc03337fa2"
          }
        ],
        "blockhash": "000000000000000007405fd882e9d4bf3d7b2388010081fe443ee1e323d8a668",
        "confirmations": 1,
        "time": 1744648860,
        "blocktime": 1744648860,
        "blockheight": 892466,
        "vincount": 1,
        "voutcount": 1,
        "voutvalue": 3.13276008
      },
      "totalFees": 0.007760080000000169
    }
  }
}

Block Headers History

Stream block headers starting at a pre-specified block height.

URL

  • Mainnet: wss://socket-v2.whatsonchain.com/websocket/blockheaders/history?from=<blockHeight>

  • Testnet: wss://socket-v2-testnet.whatsonchain.com/websocket/blockheaders/history?from=<blockHeight>

Data JSON structure
{
  "version": 779362304,
  "previousblockhash": "00000000000000000bc431648160d242fba18cbeecc076afac2b6bcd97694a6f",
  "merkleroot": "4b9279e1e866a871a91089d93a03ad49a497132d788c91ebd2034603cdea3153",
  "time": 1731361379,
  "bits": 403627096,
  "nonce": 2610332676,
  "hash": "0000000000000000049b0fa5f3b5b6ffb672c91654fb86ea56004e0b1902778f",
  "height": 870420
}

Block Transactions

Stream transactions from a block height and transaction index.

  • hex, vin and vout values are not published for message sizes greater than 10MB. Recommended to fetch details for such transactions using the REST endpoints using the published txid value.

URL

  • Mainnet: wss://socket-v2.whatsonchain.com/websocket/block/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}

  • Testnet: wss://socket-v2-testnet.whatsonchain.com/websocket/block/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}

Data JSON structure
{
  "txid": "03dd6bc953033a2b5e283b64bc3852ebbcbc1a6120fb51088e9d40d94db41871",
  "hash": "03dd6bc953033a2b5e283b64bc3852ebbcbc1a6120fb51088e9d40d94db41871",
  "size": 263,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "n": 0,
      "txid": "797bb9fe7ce40a1628d4e9a91637c555df7d429abcd51dfc774eb98c3efc7111",
      "vout": 2,
      "scriptSig": {
        "asm": "3045022100... 02e24a81ebae0...",
        "hex": "...",
        "isTruncated": false
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 OP_RETURN 746478702e617070 703a313337303439322c70726f666974",
        "hex": "006a08746478702e61707010703a...",
        "type": "nulldata",
        "isTruncated": false
      },
      "scripthash": "2ac0e4bef9f2..."
    },
    ...
  ],
  "vincount": 1,
  "voutcount": 3,
  "voutvalue": 2.2054052100000003
}

URL Parameters

Parameter
Description

blockHeight

The height of the block.

txIndex

Index of a transaction as a starting point in the first block to deliver. Default value 0.

format

Hex or json. If hex, the response will include transaction hex and metadata. If json, hex is excluded. Default value is json.

Mempool Transactions

Receive mempool transactions in real time.

  • Mempool transactions are collected from multiple nodes.

  • Client side should be idempotent because duplicate transaction events are not guaranteed to have been removed.

  • hex, vin and vout values are not published for message sizes greater than 10MB. Recommended to fetch details for such transactions using the REST endpoints using the published txid value.

URL

  • Mainnet: wss://socket-v2.whatsonchain.com/websocket/mempool?filter=<filter1,filter2,...>

  • Testnet: wss://socket-v2-testnet.whatsonchain.com/websocket/mempool?filter=<filter1,filter2,...>

Data JSON structure
{
  "channel": "woc:mempoolTx:json",
  "pub": {
    "data": {
      "txid": "0ec9f572dc98234b6ee8860a04beeaba824cb60741a5d11054dc15dc300fa666",
      "hash": "0ec9f572dc98234b6ee8860a04beeaba824cb60741a5d11054dc15dc300fa666",
      "size": 170193,
      "version": 1,
      "locktime": 0,
      "vin": [
        {
          "n": 0,
          "txid": "181cb20e80d333d87aeedf1aa3aebc5b884ef3f68d14401d6c2d5b12dc16ce71",
          "vout": 55403,
          "scriptSig": {
            "asm": "30440220... 0342494361ea8...",
            "hex": "...",
            "isTruncated": false
          },
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 1e-8,
          "n": 0,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 d5eb631a0e9d8c5728c68fc15b0e54754b29d83e OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "...",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "1LW6uqvMLPf2R62LFNnAizPjfQijE9vfsg"
            ],
            "isTruncated": false
          },
          "scripthash": "f70ee0566985..."
        },
        {
          "value": 1e-8,
          "n": 1,
          "scriptPubKey": { ... }
        },
        {
          "value": 0.00000654,
          "n": 5000,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 38041fad29e8c1dce7fbcf3fc98b800a26dd2a4c OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "...",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "167BnGMU9cXjr5tDbJSBJJekKLMTrAQcry"
            ],
            "isTruncated": false
          },
          "scripthash": "8b55ee1a86..."
        }
      ],
      "vincount": 1,
      "voutcount": 5001,
      "voutvalue": 0.00005654000000000542
    }
  }
}

URL Parameters

Parameter
Description

filter

The filter transactions based on the output (vout) types. The available filters are: nulldata, multisig, pubkey, pubkeyhash, scripthash, and nonstandard.

Chain Stats

Receive common chain stats every 10 seconds.

URL

  • Mainnet: wss://socket-v2.whatsonchain.com/websocket/stats

  • Testnet: wss://socket-v2-testnet.whatsonchain.com/websocket/stats

Data JSON structure
{
  "chainSummary": {
    "blocks": 892459,
    "bestblockhash": "0000000000000000051b71584570f8e5b335b821678c13161cf22b6ad34674c0",
    "difficulty": 59976456494.39465,
    "chainwork": "00000000000000000000000000000000000000000164d4254584d55761a28f20",
    "networkhashps": 409429675870798000,
    "circulatingSupply": 19851434.375,
    "mempoolSize": 16130,
    "mempoolBytes": 227959287,
    "mempoolUsage": 348692384,
    "exchangeRate": {
      "currency": "USD",
      "rate": "28.453333333333333"
    }
  },
  "txStatsSummary": [
    {
      "time": 1744643752,
      "txcount": 2093233133,
      "window_block_count": 144,
      "window_tx_count": 3012566,
      "window_interval": 85093,
      "txrate": 35.40321765597641
    },
    ...
  ],
  "latestBlocks": [
    {
      "hash": "0000000000000000051b71584570f8e5b335b821678c13161cf22b6ad34674c0",
      "confirmations": 1,
      "size": 140294551,
      "height": 892459,
      "version": 541065216,
      "versionHex": "20400000",
      "merkleroot": "3eee592dcd873f39bd98118582fc49b8d56e072ea28984041cd735111753edca",
      "txcount": 9723,
      "time": 1744643752,
      "mediantime": 1744641985,
      "nonce": 2459067680,
      "bits": "18125505",
      "difficulty": 59976456494.39465,
      "chainwork": "00000000000000000000000000000000000000000164d4254584d55761a28f20",
      "previousblockhash": "000000000000000004e776b40810b944b47a59ce4e8d9187eb05a351273116fe",
      "nextblockhash": "",
      "coinbaseTx": {
        "hex": "...",
        "txid": "7519a6fb28cd2796bf855b55f928c5effb0217cc0e98b935c646649bc3aba9e4",
        "hash": "7519a6fb28cd2796bf855b55f928c5effb0217cc0e98b935c646649bc3aba9e4",
        "size": 125,
        "version": 1,
        "locktime": 0,
        "vin": [
          {
            "n": 0,
            "coinbase": "032b9e0d04...",
            "sequence": 0,
            "minerInfo": {
              "name": "GorillaPool.com 🦍",
              "link": "https://GorillaPool.com",
              "type": "tag"
            }
          }
        ],
        "vout": [
          {
            "value": 3.1281591,
            "n": 0,
            "scriptPubKey": {
              "asm": "OP_DUP OP_HASH160 ad6684ded42b6a8edf8f5b64cec273c996039e02 OP_EQUALVERIFY OP_CHECKSIG",
              "hex": "...",
              "reqSigs": 1,
              "type": "pubkeyhash",
              "addresses": [
                "1GoriLLa2bdsQ8fB1CA4JNkDX88mLqXf4u"
              ],
              "isTruncated": false
            },
            "scripthash": "c3ad9b15557df4604e5699d28b71ce8a8c479759472e6b9f252c93658c56b31a"
          }
        ],
        "blockhash": "...",
        "confirmations": 1,
        "time": 1744643752,
        "blocktime": 1744643752,
        "vincount": 1,
        "voutcount": 1,
        "voutvalue": 3.1281591
      },
      "totalFees": 0.0031590999999999703
    },
    {
      "hash": "000000000000000004e776b40810b944b47a59ce4e8d9187eb05a351273116fe",
      "confirmations": 2,
      "size": 270319069,
      "height": 892458,
      ...
    }
    ...
  ]
}

Customized Events

If your application needs customized/filtered events via WebSockets, please let us know in the WoC devs Telegram channel.

Last updated

Was this helpful?