zkevm_verifiedBatchNumber | zkEVM

Polygon zkEVM API method that returns the latest verified batch number.

In the Polygon zkEVM, transactions are grouped into batches, and each batch is verified using zero-knowledge proofs. A batch is considered verified once its proof has been validated and accepted by the network.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • none

Response

  • result — the hexadecimal value of the latest verified batch number that has been added to the Polygon zkEVM network.

zkevm_verifiedBatchNumber code examples

const Web3 = require("web3");
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const web3 = new Web3(NODE_URL);

web3.extend({
    property: 'zkEVM',
    methods: [{
      name: 'verifiedBatchNumber',
      call: 'zkevm_verifiedBatchNumber',
      params: 0,
      inputFormatter: null,
      outputFormatter: null
    }]
  });

async function verifiedBatchNumber() {
  const output = await web3.zkEVM.verifiedBatchNumber()
  console.log(output)
}

verifiedBatchNumber();

const ethers = require('ethers');
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const provider = new ethers.providers.JsonRpcProvider(NODE_URL);

const verifiedBatchNumber = async () => {

    // This will return the value in Hex
    const latestVerifiedBatchNumber = await provider.send("zkevm_verifiedBatchNumber");
    console.log(`Latest Verified Batch Number: ${latestVerifiedBatchNumber}`);
};

verifiedBatchNumber();
from web3 import Web3
node_url = "YOUR_CHAINSTACK_ENDPOINT"
web3 = Web3(Web3.HTTPProvider(node_url))
output = web3.provider.make_request('zkevm_verifiedBatchNumber', [])
print(output)

Try the zkevm_verifiedBatchNumber RPC method yourself

Language
Click Try It! to start a request and see the response here!