WebSocket

Connection URL

wss://api.thespectre.io/ws

Once the socket is open, you can subscribe or unsubscribe from a topic by sending requests.

Subscribing to new block headers

Sends an update each time a new block is appended to the chain.

Sample request

{
    "method": "subscribe",
    "params": {
        "topic": "blocks"
    }
}

Request query parameters

Parameter
Description

method*

subscribe or unsubscribe

Sample response

{
    "method": "subscribe",
    "result": {
        "topic": "blocks"
    },
    "success": true
}

Sample update response

{
    "topic": "blocks",
    "data": {
        "baseFeePerGas":"10411041105",
        "burntFees":"176619293684458470",
        "transactionFees":"218996841561193633",
        "difficulty":"0x00",
        "extraData":"0x546974616e2028746974616e6275696c6465722e78797a29",
        "gasLimit":"0x1c9c380",
        "gasTargetPercentage":"13.097429",
        "gasUsed":"0x102dc06",
        "gasUsedPercentage":"56.548714",
        "hash":"0xc7ad1ebaffefaf80fd0684ba17e6f37053ccd3297313ee8ad29bea1d8a1cdc20",
        "internalTransactionCount":"597",
        "logsBloom":"0x3faf195ce3a1726d9c19e06ba145c8091fce5b0156896845036b8491e832512b0d2001ce8118631bd6161be4823503aa2af1ec6bdb062f1c9e14d72f38683928e30f451c3c250c696a83419ed51260fd268146c74c755a8a87c555518de4407b1f3de802865a8381136e9a95d9c42fd1072a62f1c11896041650971a19ce9ab40b02e2d62e0d11701ecc01c19596909764f705937155714c75ebd07708d10c2393e21163ab81e5642a0549ec10065c9666d8156c253ee39845998e7ad2d257464136490275c5bc722456bd7a3cfeb3d56cb15dcb672c261e2018ba47ac2634f4083df81c9d1c468a116445a6eda83a10a8e6bb00cbd83cc59a84c9a1c0177cb1",
        "miner":"0xe688b84b23f322a994a53dbf8e15fa82cdb71127",
        "mixHash":"0xe1fd24f0c4984b222d2c9c0b506331750e3e5c0a7ff6318fde30f5adf7f0aaa5",
        "nonce":"0x",
        "number":"0x116ee40",
        "parentHash":"0x37f722468bfe8719d9fbc1b49ed970382c54479ea06ce717493b9ddc3f4bd532",
        "receiptsRoot":"0xe1543f318efde33fb32ab7caab3e6d73a59873c17be9de3b75f04301b5fc6091",
        "reward":"59436772338192347",
        "size":"0x23962",
        "stateRoot":"0xcdee4a0c27bd0770d65c42bdfa59dc7c69136ee768431a5cb8a3a2a4693205ea",
        "timestamp":"0x651de0a7",
        "totalDifficulty":"0x0c70d815d562d3cfa955",
        "transactionCount":"189",
        "transactionsRoot":"0x46e33cedcedaa4de6747488e50444a779e0327e9f698224c29aeeda724c925a3",
        "withdrawalCount":"16",
        "confirmations":"0"
    }
}

Subscribing to new pending transactions

Sends an update each time a new transaction is appended to the mempool.

Sample request

{
    "method": "subscribe",
    "params": {
        "topic": "mempool"
    }
}

Request query parameters

Parameter
Description

method*

subscribe or unsubscribe

Sample response

{
    "method": "subscribe",
    "result": {
        "topic": "mempool"
    },
    "success": true
}

Sample update response

{
    "topic": "mempool",
    "data": {
        "from": "0x58af7455c7b23d246b62ccc0b9640ac1d4911761",
        "functionName": null,
        "gasPrice": "0",
        "hash": "0xf8f8ef28a7972aa7bd87d6203decc7c573da5787ccd71a31e52b3a3c47410692",
        "methodId": null,
        "timeStamp": "1737542831",
        "to": "0x12652c6d93fdb6f4f37d48a8687783c782bb0d10",
        "value": "0"
    }
}

Last updated