POST
/
942aad90bb6a082676497030b81e40ba
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_getBatchByNumber",
  "params": [
    "0x1FC0"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": {}
}

Polygon zkEVM API method that returns information about a specific batch of transactions based on the batch number.

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

  • batchNumber — an integer or hexadecimal string representing the batch number.

Response

  • number — a hexadecimal value representing the batch number.
  • coinbase — the address of the sequencer that virtualized this batch, for now, it refers to the Trusted Sequencer address.
  • stateRoot — the root of the final state of the batch.
  • globalExitRoot — the root of the tree that represents the deposits of the bridge (multichain). Root containing all the local exit roots of all the connected networks (in this case, a local exit root for L1 and another for L2).
  • localExitRoot — the root of the tree that represents the deposits of the zkEVM.
  • accInputHash — the hash of the inputs used to build the zero-knowledge proof for a batch. Also included in the input is the accInputHash from the previous batch, used for the aggregation of zero-knowledge proofs.
  • timestamp — the hexadecimal value of the Unix timestamp representing the exact time of the batch being verified.
  • sendSequencesTxHash — the hash of the transaction that virtualized this batch. null when it’s not virtualized yet.
  • verifyBatchTxHash — the hash of the transaction that verified this batch. null when it’s not verified yet.
  • transactions[] — an array of hashes of all the transactions included in the batch.

zkevm_getBatchByNumber code examples

const Web3 = require("web3");

const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";

const web3 = new Web3(NODE_URL);



web3.extend({

    property: 'zkEVM',

    methods: [{

      name: 'getBatchByNumber',

      call: 'zkevm_getBatchByNumber',

      params: 1,

      inputFormatter: null,

      outputFormatter: null

    }]

  });



async function getBatchByNumber(batchNumber) {

  const output = await web3.zkEVM.getBatchByNumber(batchNumber)

  console.log(output)

}



getBatchByNumber(8128);

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:zkevm_getBatchByNumber
params
string[]

Response

200 - application/json
Returns information about a specific batch of transactions based on the batch number.
jsonrpc
string
id
integer
result
object