zkevm_isBlockConsolidated | zkEVM

Polygon zkEVM API method that checks if a specific block has been consolidated.
The zkevm_isBlockConsolidated method allows users to check whether a specific block is part of a consolidated batch or not.

👍

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

  • blockNumber — the block number to check if it is connected to a verified batch, encoded as hexadecimal.

Response

  • result — a boolean value indicating whether the block is connected to a verified batch or not.

zkevm_isBlockConsolidated code examples

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

web3.extend({
    property: 'zkEVM',
    methods: [{
      name: 'isBlockConsolidated',
      call: 'zkevm_isBlockConsolidated',
      params: 1,
      inputFormatter: null,
      outputFormatter: null
    }]
  });

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

isBlockConsolidated("0xd29e");
const ethers = require('ethers');
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const isBlockConsolidated = async (blockNumber) => {

    // This will return a boolean value
    const isConsolidated = await provider.send("zkevm_isBlockConsolidated", [blockNumber]);
    console.log(`Is Block ${blockNumber} Consolidated: ${isConsolidated}`);
};

// Replace "0xd29e" with the desired block number in hexadecimal format
isBlockConsolidated("0xd29e");
from web3 import Web3
node_url = "YOUR_CHAINSTACK_ENDPOINT"
web3 = Web3(Web3.HTTPProvider(node_url))
output = web3.provider.make_request('zkevm_isBlockConsolidated', ["0xd29e"])
print(output)

Try the zkevm_isBlockConsolidated RPC method yourself

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