zkevm_isBlockVirtualized | zkEVM

Polygon zkEVM API method that checks if a specific block has been virtualized. In the zkEVM, virtualization is the process of converting a block's data into a zero-knowledge proof. This method allows you to verify if a block has been virtualized and is part of the blockchain.

👍

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 — (string) the block number to check if it has been virtualized, encoded as a hexadecimal value.

Response

  • result — (boolean) true if the specified block has been virtualized, and false otherwise.

zkevm_isBlockVirtualized code examples

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

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

async function isBlockVirtualized(blockId) {
  const block = await web3.zkEVM.isBlockVirtualized(blockId)
  console.log(block)
}

isBlockVirtualized("0xd29e");

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

const isBlockVirtualized = async (blockNumber) => {

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

//replace 0xd29e with any block number
isBlockVirtualized("0xd29e");
from web3 import Web3
node_url = "YOUR_CHAINSTACK_ENDPOINT"
web3 = Web3(Web3.HTTPProvider(node_url))
output = web3.provider.make_request('zkevm_isBlockVirtualized', ["0xd29e"])
print(output)

Try the zkevm_isBlockVirtualized RPC method yourself

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