zks_getL1BatchDetails - zkSync
Example code for the zks_getL1BatchDetails JSON-RPC method. Сomplete guide on how to use zks_getL1BatchDetails JSON-RPC in GetBlock.io Web3 documentation.
Returns full details for an L1 batch, including the commit, prove, and execute transaction hashes on Ethereum mainnet, along with associated timestamps and gas prices.
Parameters
l1BatchNumber
integer
Yes
The L1 batch number to query
Request Example
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "zks_getL1BatchDetails",
"params": [
468355
],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "zks_getL1BatchDetails",
"params": [
468355
],
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.log(error));Response Example
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"number": 468355,
"timestamp": 1711649164,
"l1TxCount": 1,
"l2TxCount": 2363,
"rootHash": "0x7b31ef880f09238f13b71a0f6bfea340b9c76d01bba0712af6aa0a4f224be167",
"status": "verified",
"commitTxHash": "0x5b2598bf1260d498c1c6a05326f7416ef2a602b8a1ac0f75b583cd6e08ae83cb",
"committedAt": "2024-03-28T18:24:49.713730Z",
"proveTxHash": "0xc02563331d0a83d634bc4190750e920fc26b57096ec72dd100af2ab037b43912",
"provenAt": "2024-03-29T03:09:19.634524Z",
"executeTxHash": "0xbe1ba1fdd17c2421cf2dabe2908fafa26ff4fa2190a7724d16295dd9df72b144",
"executedAt": "2024-03-29T18:18:04.204270Z",
"l1GasPrice": 47875552051,
"l2FairGasPrice": 25000000,
"baseSystemContractsHashes": {
"bootloader": "0x010007ede999d096c84553fb514d3d6ca76fbf39789dda76bfeda9f3ae06236e",
"default_aa": "0x0100055b041eb28aff6e3a6e0f37c31fd053fc9ef142683b05e5f0aee6934066"
}
}
}Response Parameters
result.number
integer
L1 batch number (echoed)
result.timestamp
integer
Unix timestamp when the batch was processed
result.l1TxCount
integer
Number of L1 transactions in the batch
result.l2TxCount
integer
Number of L2 transactions in the batch
result.rootHash
string
Root hash of the state after processing the batch
result.status
string
Status: committed, proven, or executed/verified
result.commitTxHash
string
Ethereum tx hash of the commit operation
result.proveTxHash
string
Ethereum tx hash of the proof submission
result.executeTxHash
string
Ethereum tx hash of the execution
result.l1GasPrice
integer
L1 gas price at the time of batch processing
result.l2FairGasPrice
integer
Fair gas price on L2 at the time of batch processing
Use Cases
L1-L2 settlement monitoring
Batch explorers showing commit/prove/execute timeline
Auditing zkSync's finality cadence
Error Handling
403
Forbidden
Missing or invalid <ACCESS-TOKEN>
429
Too Many Requests
Rate limit exceeded for your plan
SDK Integration
Last updated
Was this helpful?