curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "zkevm_batchNumberByBlockNumber",
"params": [
"0xD65B"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "zkevm_batchNumberByBlockNumber",
"params": [
"0xD65B"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
blockNumber
— a hexadecimal string representing a block number in the Polygon zkEVM chain.result
— a string representing the batch number of the specified block number in the zkEVM chain.zkevm_batchNumberByBlockNumber
code examplesconst Web3 = require("web3");
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const web3 = new Web3(NODE_URL);
web3.extend({
property: 'zkEVM',
methods: [{
name: 'batchNumberByBlockNumber',
call: 'zkevm_batchNumberByBlockNumber',
params: 1,
inputFormatter: null,
outputFormatter: null
}]
});
async function batchNumberByBlockNumber(blockId) {
const output = await web3.zkEVM.batchNumberByBlockNumber(blockId)
console.log(output)
}
batchNumberByBlockNumber("0xD65B");
Returns the batch number associated with the given block number.
The response is of type object
.
Was this page helpful?