curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"latest",
false
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"latest",
false
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}mainBlockGeneralGasLimit, sharedGasLimit, and timestampMillisPart for sub-second precision.
blockNumber — the block number (hex) or tag (latest, earliest, pending)fullTransactions — if true, returns full transaction objects; if false, returns only transaction hashesresult — a block object, or null if no block was found:
number — the block numberhash — the block hashparentHash — hash of the parent blocktimestamp — block timestamp in secondstimestampMillisPart — sub-second timestamp (0-999 ms), Tempo-specifictransactions — array of transaction objects or hasheseth_getBlockByNumber code examplesconst Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getBlockByNumber() {
const block = await web3.eth.getBlock("latest");
console.log(block);
}
getBlockByNumber()
Was this page helpful?