Blocks

Get the most recent block number

Returns number of the most recent block.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getlatestblockno
   &apikey=YourApiKeyToken

Sample response

{
    "status": "1",
    "message": "OK",
    "result": "0x26a8c"
}

Get block header by block number

Returns block header (including hashes of the transactions) by block number.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblockbyno
   &blockno=18280000
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

blockno*

a nonnegative integer that represents the block number

Sample response

{
    "status": "1",
    "message": "OK",
    "result": {
        "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"
    }
}

Get block header by block hash

Returns block header (including hashes of the transactions) by block hash.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblockbyhash
   &blockhash=0xc7ad1ebaffefaf80fd0684ba17e6f37053ccd3297313ee8ad29bea1d8a1cdc20
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

blockhash*

hash of contents of the block

Sample response

{
    "status": "1",
    "message": "OK",
    "result": {
        "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"
    }
}

Get an array of block headers by block number range

Returns an array of block headers by block number range (maximum of 20 blocks per call).

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblockrange
   &startblock=32
   &endblock=33
   &sort=asc
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

startblock*

the integer block number that represents the first number of range

endblock*

the integer block number that represents the last number of range

sort*

the sorting preference, use asc to sort by ascending and desc to sort by descending

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "transactionFees":"218996841561193633",
            "difficulty": "0x01",
            "extraData": "0xd883010101846765746888676f312e31382e32856c696e757800000000000000000000000000000001002817cc25419648d1e49c753138ef6d4e67db506d4626accfb83a14a929f529161158182dbe1209c8aba1e7929e09c08c594eb273ad4d4212cb1ecace66292f9501",
            "gasLimit": "0x21ad8ff",
            "gasUsed": "0x1b228",
            "hash": "0xe12c3f908d1745c383c3f70ba87bdf5c17ac9942818d2d7978b73226de4409dd",
            "logsBloom": "0x00000004000000001000000000400000000000000000000000000000000000000000000002000000000000000000000000080000400080000008000000000000000000400000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000100000000000004000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xeba8ddf0ab5dc9320c8ce4a14750293ee4f9b7b9",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x",
            "number": "0x20",
            "parentHash": "0x548a6e00111ac0695739c664da6b40b7d448901626019749835443cad57bd3ca",
            "receiptsRoot": "0x87b2712fcff4c8fdb04ad800a4e9687e21773350bf7045938314f64a431b805c",
            "size": "0x31b",
            "stateRoot": "0xebdd7d4ee81fd4850aaf0e7012095324857985e066238595312ff00ee1d030f7",
            "timestamp": "0x62d047b5",
            "totalDifficulty": "0x21",
            "transactionsRoot": "0x821fad531e0735fe9bd2829d4b848b49017fbbbd798923ee9c199e46f48f9a95",
            "reward": "12000000000000",
            "transactionCount": "1",
            "internalTransactionCount": "0"
        },
        {
            "transactionFees":"218996841561193633",
            "difficulty": "0x01",
            "extraData": "0xd883010101846765746888676f312e31382e32856c696e757800000000000000000000000000000001083f3f2f20e1ae171dfea4a4d0c0b94c88d150d09d95380dd23e5b9f7d5a873d8e5f17dbf6da2169abf4b054cd86145ebc41f21fa3d535ea37ab9b3fc8d67f1c9500",
            "gasLimit": "0x218c0b3",
            "gasUsed": "0x6079",
            "hash": "0xdef139f93c797aa55da19e754b705b21b21df3f3f57812028ad1c35d8bb8f1ec",
            "logsBloom": "0x00000000000000001000000000400000000000000000000000000000000000000000000002000000000000000000000000280000400080000008000000000000000000400000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000040010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xeba8ddf0ab5dc9320c8ce4a14750293ee4f9b7b9",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x",
            "number": "0x21",
            "parentHash": "0xe12c3f908d1745c383c3f70ba87bdf5c17ac9942818d2d7978b73226de4409dd",
            "receiptsRoot": "0xb4bbc360704afa56678d4d25e4280cd448bd166242c0722e79dd80de843acad4",
            "size": "0x31a",
            "stateRoot": "0xf326e7a19a4fa308c5394b1dd1a06431b04ccb4e758f5ac593ab6671a0fe83fd",
            "timestamp": "0x62d047bb",
            "totalDifficulty": "0x22",
            "transactionsRoot": "0x747ce12f2c5292cc82580477ec543caf4ee4d3155c44b5c8300f0ff4ac348112",
            "reward": "12000000000000",
            "transactionCount": "1",
            "internalTransactionCount": "0"
        }
    ]
}

Get an array of block headers by number list

Returns an array of block headers by number list (maximum of 20 blocks per call).

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblocklist
   &blockno=32,33
   &sort=asc
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

blockno*

the numbers separated by ,

sort

the sorting preference, use asc to sort by ascending and desc to sort by descending, desc is default

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "transactionFees":"218996841561193633",
            "difficulty": "0x01",
            "extraData": "0xd883010101846765746888676f312e31382e32856c696e757800000000000000000000000000000001002817cc25419648d1e49c753138ef6d4e67db506d4626accfb83a14a929f529161158182dbe1209c8aba1e7929e09c08c594eb273ad4d4212cb1ecace66292f9501",
            "gasLimit": "0x21ad8ff",
            "gasUsed": "0x1b228",
            "hash": "0xe12c3f908d1745c383c3f70ba87bdf5c17ac9942818d2d7978b73226de4409dd",
            "logsBloom": "0x00000004000000001000000000400000000000000000000000000000000000000000000002000000000000000000000000080000400080000008000000000000000000400000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000100000000000004000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xeba8ddf0ab5dc9320c8ce4a14750293ee4f9b7b9",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x",
            "number": "0x20",
            "parentHash": "0x548a6e00111ac0695739c664da6b40b7d448901626019749835443cad57bd3ca",
            "receiptsRoot": "0x87b2712fcff4c8fdb04ad800a4e9687e21773350bf7045938314f64a431b805c",
            "size": "0x31b",
            "stateRoot": "0xebdd7d4ee81fd4850aaf0e7012095324857985e066238595312ff00ee1d030f7",
            "timestamp": "0x62d047b5",
            "totalDifficulty": "0x21",
            "transactionsRoot": "0x821fad531e0735fe9bd2829d4b848b49017fbbbd798923ee9c199e46f48f9a95",
            "reward": "12000000000000",
            "transactionCount": "1",
            "internalTransactionCount": "0"
        },
        {
            "transactionFees":"218996841561193633",
            "difficulty": "0x01",
            "extraData": "0xd883010101846765746888676f312e31382e32856c696e757800000000000000000000000000000001083f3f2f20e1ae171dfea4a4d0c0b94c88d150d09d95380dd23e5b9f7d5a873d8e5f17dbf6da2169abf4b054cd86145ebc41f21fa3d535ea37ab9b3fc8d67f1c9500",
            "gasLimit": "0x218c0b3",
            "gasUsed": "0x6079",
            "hash": "0xdef139f93c797aa55da19e754b705b21b21df3f3f57812028ad1c35d8bb8f1ec",
            "logsBloom": "0x00000000000000001000000000400000000000000000000000000000000000000000000002000000000000000000000000280000400080000008000000000000000000400000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000040010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xeba8ddf0ab5dc9320c8ce4a14750293ee4f9b7b9",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x",
            "number": "0x21",
            "parentHash": "0xe12c3f908d1745c383c3f70ba87bdf5c17ac9942818d2d7978b73226de4409dd",
            "receiptsRoot": "0xb4bbc360704afa56678d4d25e4280cd448bd166242c0722e79dd80de843acad4",
            "size": "0x31a",
            "stateRoot": "0xf326e7a19a4fa308c5394b1dd1a06431b04ccb4e758f5ac593ab6671a0fe83fd",
            "timestamp": "0x62d047bb",
            "totalDifficulty": "0x22",
            "transactionsRoot": "0x747ce12f2c5292cc82580477ec543caf4ee4d3155c44b5c8300f0ff4ac348112",
            "reward": "12000000000000",
            "transactionCount": "1",
            "internalTransactionCount": "0"
        }
    ]
}

Get block number by block timestamp

Returns block number by the closest timestamp.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblocknobytimestamp
   &timestamp=1658293068
   &closest=after
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

timestamp*

a nonnegative integer that represents the block timestamp (Unix timestamp in seconds)

closest*

direction to find the closest block number to given timestamp. Available values: before and after

Sample response

{
    "status": "1",
    "message": "OK",
    "result": "0x26a8c"
}

Get block account balances changes by block number

Returns all account balances changes in a block by block number.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=getblockbalancechanges
   &blockno=18274635
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

blockno*

a nonnegative integer that represents the block number

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address":"0x4bfa9092250d3f43001d06bc643c3f4d16a52046",
            "balance":"0",
            "balanceChange":"-2179183350000000000",
            "prevChangeBlockNumber": "18271896",
            "prevChangeTimeStamp": "1696359011"
        },
        {
            "address":"0x0878968154a84ca6665f2df1cebb0d3ceb5ec04a",
            "balance":"19055000000000000",
            "balanceChange":"19055000000000000"
        }
    ]
}

Get beacon chain withdrawals by block range

Returns the beacon chain withdrawals.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=txsBeaconWithdrawal
   &startblock=17034877
   &endblock=17034877
   &sort=desc
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

startblock

the integer block number to start searching for transactions, default value is 0

endblock

the integer block number to stop searching for transactions, default value is 1000000000

offset

skips the offset records before beginning to return the records, default value is 0

limit

the number of records displayed per page, default value is 10000

sort

the sorting preference, use asc to sort by ascending and desc to sort by descending, default value is asc

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "withdrawalIndex": "13",
            "validatorIndex": "117823",
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "3402931175",
            "blockNumber": "17034877",
            "timestamp": "1681338599"
        },
        {
            "withdrawalIndex": "14",
            "validatorIndex": "119023",
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "3244098967",
            "blockNumber": "17034877",
            "timestamp": "1681338599"
        }
    ]
}

Get beacon chain withdrawal count by block range

Returns the beacon chain withdrawal count.

Sample request

https://api.thespectre.io/api
   ?module=block
   &action=txsBeaconWithdrawalCount
   &startblock=17034877
   &endblock=17034877
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

startblock

the integer block number to start searching for transactions, default value is 0

endblock

the integer block number to stop searching for transactions, default value is 1000000000

Sample response

{
    "status": "1",
    "message": "OK",
    "result": "16"
}

Last updated