ZKs specific JSON-RPC API

Overview of the JSON-RPC API methods specific to Cronos zkEVM, detailing operations and functionalities within the Cronos zkEVM ecosystem.

Overview

Based on ZK Stack - besides stand Ethereum JSON-RPCs, Cronos zkEVM provides a suite of JSON-RPC API methods designed for seamless interaction with its ecosystem. These methods offer developers the tools needed to integrate their applications with Cronos zkEVM's features, enhancing the capability to perform transactions, query network data, and interact with smart contracts efficiently. This guide builds on the zkSync Era documentation, adapting it to the features and requirements of the Cronos zkEVM chain environment.

ZK Stack specific API Methods

zk_estimateFee

Estimates the fee for a given call request.

Parameters

CallRequest - object

  • from: DATA, 20 bytes - Sender address. Arbitrary if not provided.

  • to: DATA, 20 bytes - Recipient address. Required for eth_call.

  • gas: QUANTITY - Gas limit for the transaction. Defaults if not provided.

  • gas_price: QUANTITY - Gas price for the transaction. Defaults if not provided.

  • max_fee_per_gas: QUANTITY - Maximum fee per unit of gas.

  • max_priority_fee_per_gas: QUANTITY - Maximum priority fee per unit of gas.

  • value: QUANTITY - Value transferred in the transaction. None for no transfer.

  • data / input: DATA - Data sent with the transaction. Empty if not provided.

  • nonce: DATA, 32 bytes - Transaction nonce.

  • transaction_type: QUANTITY, 8 bytes - Type of the transaction.

  • access_list: AccessList - EIP-2930 access list.

  • customData: OBJECT - Extra parameters for EIP712 transactions, like paymasterParams or customSignature.

Returns

The method returns an object containing the estimated gas and fee details for the given call request.

  • gas_limit: QUANTITY, 32 bytes - The maximum amount of gas that can be used.

  • max_fee_per_gas: QUANTITY, 32 bytes - The maximum fee per unit of gas that the sender is willing to pay.

  • max_priority_fee_per_gas: QUANTITY, 32 bytes - The maximum priority fee per unit of gas to incentivize miners.

  • gas_per_pubdata_limit: QUANTITY, 32 bytes - The gas limit per unit of public data.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 2,
      "method": "zks_estimateFee",
      "params": [
        {
          "from": "0x1111111111111111111111111111111111111111",
          "to": "0x2222222222222222222222222222222222222222",
          "data": "0xffffffff"
        }
      ]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "gas_limit": "0x1f96a",
    "max_fee_per_gas": "0x246139ca800",
    "max_priority_fee_per_gas": "0x0",
    "gas_per_pubdata_limit": "0x0"
  },
  "id": 2
}

zks_estimateGasL1ToL2

Estimates the gas required for an L1 to L2 transaction.

Parameters

CallRequest - object

  • from: DATA, 20 bytes - Sender address. Arbitrary if not provided.

  • to: DATA, 20 bytes - Recipient address. Required for eth_call.

  • gas: QUANTITY - Gas limit for the transaction. Defaults if not provided.

  • gas_price: QUANTITY - Gas price for the transaction. Defaults if not provided.

  • max_fee_per_gas: QUANTITY - Maximum fee per unit of gas.

  • max_priority_fee_per_gas: QUANTITY - Maximum priority fee per unit of gas.

  • value: QUANTITY - Value transferred in the transaction. None for no transfer.

  • data / input: DATA - Data sent with the transaction. Empty if not provided.

  • nonce: DATA, 32 bytes - Transaction nonce.

  • transaction_type: QUANTITY, 8 bytes - Type of the transaction.

  • access_list: AccessList - EIP-2930 access list.

  • customData: OBJECT - Extra parameters for EIP712 transactions, like paymasterParams or customSignature.

Returns

QUANTITY, 32 bytes - The estimated gas amount in hexadecimal format, representing the number of gas units required.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 2,
      "method": "zks_estimateGasL1ToL2",
      "params": [
        {
          "from": "0x1111111111111111111111111111111111111111",
          "to": "0x2222222222222222222222222222222222222222",
          "data": "0xffffffff"
        }
      ]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x54769f",
  "id": 2
}

zks_getBridgehubContract

Retrieves the bridge hub contract address.

Parameters

None

Returns

DATA, 20 bytes - a single string value representing the bridge hub contract address.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org  \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getBridgehubContract",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x303a465b659cbb0ab36ee643ea362c509eeb5213",
  "id": 1
}

zks_getMainContract

Retrieves the main contract address.

Parameters

None

Returns

DATA, 20 bytes - address of the main contract.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org  \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getMainContract",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x7b2da4e77bae0e0d23c53c3be6650497d0576cfc",
  "id": 1
}

zks_getTestnetPaymaster

Retrieves the testnet paymaster address, specifically for interactions within the Cronos zkEVM Testnet environment. Note: This method is only applicable for Cronos zkEVM Testnet.

Parameters

None

Returns

DATA, 20 bytes - address of the testnet paymaster.

Example Request

curl --request POST \
  --url https://testnet.zkevm.cronos.org  \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getTestnetPaymaster",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x123a22806120ad451b98c49d06f2c96bbee91e36",
  "id": 1
}

zks_getBridgeContracts

Retrieves the addresses of canonical bridge contracts for Cronos zkEVM.

Parameters

None

Returns

Object containing the addresses of bridge contracts.

  • l1Erc20DefaultBridge: DATA, 20 bytes - address of the default ERC-20 bridge on Layer 1.

  • l2Erc20DefaultBridge: DATA, 20 bytes - address of the default ERC-20 bridge on Layer 2.

  • l1WethBridge: DATA, 20 bytes - address of the Wrapped Ethereum (WETH) bridge on Layer 1.

  • l2WethBridge: DATA, 20 bytes - address of the Wrapped Ethereum (WETH) bridge on Layer 2.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getBridgeContracts",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "l1SharedDefaultBridge": "0xd7f9f54194c633f36ccd5f3da84ad4a1c38cb2cb",
    "l2SharedDefaultBridge": "0x309429de3621992cb0ab8982a448c9cc5c38405b",
    "l1Erc20DefaultBridge": "0x57891966931eb4bb6fb81430e6ce0a03aabde063",
    "l2Erc20DefaultBridge": "0x309429de3621992cb0ab8982a448c9cc5c38405b",
    "l1WethBridge": "0x0000000000000000000000000000000000000000",
    "l2WethBridge": "0x0000000000000000000000000000000000000000"
  },
  "id": 1
}

zks_L1ChainId

Retrieves the L1 chain ID.

Parameters

None

Returns

QUANTITY, 8 bytes - The hexadecimal representation of the L1 chain ID.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_L1ChainId",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x1",
  "id": 1
}

zks_getBaseTokenL1Address

Retrieves the L1 base token address.

Parameters

None

Returns

DATA, 20 bytes - Layer 1 Ethereum address of base token.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getBaseTokenL1Address",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x28ff2e4dd1b58efeb0fc138602a28d5ae81e44e2",
  "id": 1
}

zks_getConfirmedTokens

Lists confirmed tokens. Confirmed in the method name means any token bridged to Cronos zkEVM via the official bridge.

The tokens are returned in alphabetical order by their symbol. This means the token id is its position in an alphabetically sorted array of tokens.

Parameters

uint32 - token id from which to start.

uint8 - maximum number of tokens to list.

Returns

Array of token objects, each containing details about a specific confirmed token.

  • l1Address: DATA, 20 bytes - Layer 1 Ethereum address of the token.

  • l2Address: DATA, 20 bytes - Layer 2 Cronos zkEVM address of the token.

  • name: String - name of the token.

  • symbol: String - symbol of the token.

  • decimals: uint8 - number of decimals the token uses.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org/ \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getConfirmedTokens",
      "params": [0,1]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": [
    {
      "l1Address": "0x0000000000000000000000000000000000000000",
      "l2Address": "0x0000000000000000000000000000000000000000",
      "name": "Ether",
      "symbol": "ETH",
      "decimals": 18
    }
  ],
  "id": 1
}

zks_getAllAccountBalances

Gets all account balances for a given address.

Parameters

DATA, 20 bytes - account address.

Returns

The method returns an object with token addresses as keys and their corresponding balances as values. Each key-value pair represents the balance of a specific token held by the account.

  • <DATA, 20 bytes>: QUANTITY, 32 bytes - The token address is the key, and its value is the balance of that token held by the account, represented in the smallest unit of the token (e.g., wei for ETH).

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getAllAccountBalances",
      "params": ["0x271602a97027ee1dd03b1e6e5db153eb659a80b1"]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "0xf226a595b83056ff3d26b827e3d5b0896e4392a9": "0x55d166a12174488855"
  },
  "id": 1
}

zks_getL2ToL1MsgProof

Retrieves the proof for an L2 to L1 message.

Parameters

uint32 - L2 block number.

DATA, 20 bytes - sender's address.

DATA, 32 bytes - message hash.

number - Optional. The log position in L2.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getL2ToL1MsgProof",
      "params": []
    }'

Example Response

...

zks_getL2ToL1LogProof

Retrieves the log proof for an L2 to L1 transaction.

Parameters

DATA, 32 bytes - transaction hash.

integer - Optional. Index of the log.

Returns

  • proof: Array of DATA, 32 bytes - array of strings, each representing a piece of the proof for the specified log.

  • id: integer - identifier of the log within the transaction.

  • root: DATA, 32 bytes - root hash of the proof, anchoring it to a specific state in the blockchain.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getL2ToL1LogProof",
      "params": [
        "0xdba49ca01eba2281556896d8ebb9a3db846bc852afe0113916d4f78f2f658946"
      ]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "proof": [
      "0xaa6de2d561e4583f7f2d8dd0b5df6cbff96b689b435d40c515f90e1b2a3a50a9",
      "0x93ea63c2f255ee08ff74d63fc442b1a6a6797dff3ce863520255216404918ff9",
      "0xb7188e225c78aaf9002f8dd825e96389504324dc4b6ecf3ded35329ee7899d52",
      "0x8e13cf0dfcb9649dc34f0095941da419143c7e6df7fcc31cbcc90b413efdacd2",
      "0x8a2be504f2c242fac995e2e46caa09ba1849453e8ae031a6d51ecb76f43fe849",
      "0x8639d3c7e2aaaa4b6795859be623182e30201c6ee0fb71b6b8b42417cbb54ea6",
      "0x574c090e614f11a2dbc3041bc0edf84763bceb8d2637f1d9d1b76483e98ec921",
      "0x553479372351c5f3648bd1289f38fe73e82963835bfa086665f14cf65288c775",
      "0xac506ecb5465659b3a927143f6d724f91d8d9c4bdb2463aee111d9aa869874db",
      "0x124b05ec272cecd7538fdafe53b6628d31188ffb6f345139aac3c3c1fd2e470f",
      "0xc3be9cbd19304d84cca3d045e06b8db3acd68c304fc9cd4cbffe6d18036cb13f",
      "0xfef7bd9f889811e59e4076a0174087135f080177302763019adaf531257e3a87",
      "0xa707d1c62d8be699d34cb74804fdd7b4c568b6c1a821066f126c680d4b83e00b",
      "0xf6e093070e0389d2e529d60fadb855fdded54976ec50ac709e3a36ceaa64c291"
    ],
    "id": 60,
    "root": "0xbe63c30b864e0c763b37ea274a479e132c422f0e938ca50d20fb01be2fe8e620"
  },
  "id": 1
}

zks_L1BatchNumber

Retrieves the current L1 batch number.

Parameters

None

Returns

QUANTITY, 8 bytes - hexadecimal representation of the current L1 batch number.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_L1BatchNumber",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0x20",
  "id": 1
}

zks_getBlockDetails

Retrieves details for a given block.

  • committed: The batch is closed and the state transition it creates exists on layer 1.

  • proven: The batch proof has been created, submitted, and accepted on layer 1.

  • executed: The batch state transition has been executed on L1; meaning the root state has been updated.

Parameters

The method requires a single parameter to specify the block whose details are to be retrieved.

uint32 - number of the block.

Returns

Object containing detailed information about the specified block.

  • number: uint32 - number of the block.

  • l1BatchNumber: uint32 - corresponding L1 batch number.

  • timestamp: uint32 - Unix timestamp when the block was committed.

  • l1TxCount: uint32 - number of L1 transactions included in the block.

  • l2TxCount: uint32 - number of L2 transactions included in the block.

  • rootHash: DATA, 32 bytes - root hash of the block's state after execution.

  • status: String - current status of the block (e.g., verified, executed).

  • commitTxHash: DATA, 32 bytes - transaction hash of the commit operation on L1.

  • committedAt: String - timestamp when the block was committed on L1.

  • proveTxHash: DATA, 32 bytes - transaction hash of the proof submission on L1.

  • provenAt: String - timestamp when the proof was submitted on L1.

  • executeTxHash: DATA, 32 bytes - transaction hash of the execution on L1.

  • executedAt: String - timestamp when the block execution was completed on L1.

  • l1GasPrice: uint64 - L1 gas price at the time of the block's execution.

  • l2FairGasPrice: uint64 - fair gas price on L2 at the time of the block's execution.

  • baseSystemContractsHashes: Object - A collection of hashes for the base system contracts.

  • operatorAddress: DATA, 20 bytes - address of the operator who committed the block.

  • protocolVersion: String - version of the protocol the block was committed under.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getBlockDetails",
      "params": [91513]
    }'

Example Response

{
"jsonrpc":"2.0",
"result":{
"number":91513,
"l1BatchNumber":33,
"timestamp":1724195097,
"l1TxCount":0,
"l2TxCount":1,
"rootHash":"0x7af242a8bdbe28f5b21816b741aeb4cf5f6193db4be63139d27530c226bddaf3","status":"sealed",
"commitTxHash":null,
"committedAt":null,
"proveTxHash":null,
"provenAt":null,
"executeTxHash":null,
"executedAt":null,
"l1GasPrice":1768937160,
"l2FairGasPrice":2500000000000,
"fairPubdataPrice":0,
"baseSystemContractsHashes":{
   "bootloader":"0x010008e742608b21bf7eb23c1a9d0602047e3618b464c9b59c0fba3b3d7ab66e",
   "default_aa":"0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32"
   },
   "operatorAddress":"0xa34e3001b04ac693daa6d915060e9bf0b97baf47",
   "protocolVersion":"Version24"
   },
   "id":1
   }

zks_getTransactionDetails

Retrieves details for a given transaction.

Parameters

DATA, 32 bytes - hash of the transaction.

Returns

Object containing detailed information about the specified transaction.

  • isL1Originated: Boolean - Indicates whether the transaction originated on Layer 1.

  • status: String - current status of the transaction (e.g., verified).

  • fee: QUANTITY, 32 bytes - transaction fee.

  • gasPerPubdata: QUANTITY, 32 bytes - gas amount per unit of public data for this transaction.

  • initiatorAddress: DATA, 20 bytes - address of the transaction initiator.

  • receivedAt: String - timestamp when the transaction was received.

  • ethCommitTxHash: DATA, 32 bytes - transaction hash of the commit operation.

  • ethProveTxHash: DATA, 32 bytes - transaction hash of the proof submission.

  • ethExecuteTxHash: DATA, 32 bytes - transaction hash of the execution.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getTransactionDetails",
      "params": [
        "0xdba49ca01eba2281556896d8ebb9a3db846bc852afe0113916d4f78f2f658946"
      ]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "isL1Originated": true,
    "status": "verified",
    "fee": "0x0",
    "gasPerPubdata": "0x320",
    "initiatorAddress": "0x09a2422550281f058db80f224dcfda975cd3aff5",
    "receivedAt": "2023-03-03T23:52:24.169Z",
    "ethCommitTxHash": "0x90ac50e40a3b7f090d780e82a4d46615cd6858790ed9c1c1b5069aae68bb1025",
    "ethProveTxHash": "0x5243af1324bff0b4dfef755d1a2f655e8ada1e6f3cea3d7fcd522cd6ddb446d8",
    "ethExecuteTxHash": "0x31dcab2df135044d8f9b1d576636169de3ff36475a897e32228656d0e5982450"
  },
  "id": 1
}

zks_getRawBlockTransactions

Lists transactions in a block without processing them.

Parameters

uint32 - number of the block.

Returns

Array of objects, each representing a raw transaction within the specified block. Each transaction object includes common data, execution details, a timestamp, and the raw transaction bytes.

  • common_data: Object - general information about the L2 transaction, such as nonce, fees, initiator address, signature, transaction type, input data, and paymaster parameters.

  • execute: Object - Details regarding the execution of the transaction, including the contract address, calldata, value, and any factory dependencies.

  • received_timestamp_ms: Number - timestamp when the transaction was received, in milliseconds.

  • raw_bytes: DATA, 32 bytes - raw bytes of the transaction as a hexadecimal string.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getRawBlockTransactions",
      "params": [99083]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": [
    {
      "common_data": {
        "L2": {
          "nonce": 41,
          "fee": {
            "gas_limit": "0x729b1",
            "max_fee_per_gas": "0x2632e314a00",
            "max_priority_fee_per_gas": "0x2632e314a00",
            "gas_per_pubdata_limit": "0xc350"
          },
          "initiatorAddress": "0x1791e7a4378d44a5f0aa43095f828c7ef3f88196",
          "signature": [52,145,129,230,119,80,115,128,182,4,234,186...],
          "transactionType": "LegacyTransaction",
          "input": {
            "hash": "0x5bb47835a196291545ef31c0dccd03112650db893a18fc63bfa2124ca1fb5b8b",
            "data": [249,2,46,41,134,2,99,46,49,74,0,131,7...]
          },
          "paymasterParams": {
            "paymaster": "0x0000000000000000000000000000000000000000",
            "paymasterInput": []
          }
        }
      },
      "execute": {
        "contractAddress": "0x4e792b8c9bcb9e200c3713810c4d6ea8c4230e7c",
        "calldata": "0x5ae401dc000000000000000000000000000000000000000...",
        "value": "0x0",
        "factoryDeps": null
      },
      "received_timestamp_ms": 1724268831091,
      "raw_bytes": "0xf9022e298602632e314a00830729.."
    }
    // Additional transactions
  ],
  "id": 1
}

zks_getL1BatchDetails

Retrieves details for a given L1 batch.

Parameters

uint32 - L1 batch number.

Returns

Object of details for L1 batch.

  • number: uint32 - L1 batch number.

  • timestamp: uint64 - Unix timestamp when the batch was processed.

  • l1TxCount: uint32 - number of L1 transactions included in the batch.

  • l2TxCount: uint32 - number of L2 transactions associated with this batch.

  • rootHash: DATA, 32 bytes - root hash of the state after processing the batch.

  • status: String - current status of the batch (e.g., verified).

  • commitTxHash: DATA, 32 bytes - Ethereum transaction hash for the commit operation.

  • committedAt: String - timestamp when the batch was committed on Ethereum.

  • proveTxHash: DATA, 32 bytes - Ethereum transaction hash for the proof submission.

  • provenAt: String - timestamp when the proof was submitted.

  • executeTxHash: DATA, 32 bytes - Ethereum transaction hash for the execution.

  • executedAt: String - timestamp when the execution was completed.

  • l1GasPrice: uint64 - gas price on L1 at the time of batch processing.

  • l2FairGasPrice: uint64 - fair gas price on L2 at the time of batch processing.

  • baseSystemContractsHashes: Object - Hashes of the base system contracts involved in the batch.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getL1BatchDetails",
      "params": [28]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "baseSystemContractsHashes": {
      "bootloader": "0x0100038581be3d0e201b3cc45d151ef5cc59eb3a0f146ad44f0f72abf00b594c",
      "default_aa": "0x0100038dc66b69be75ec31653c64cb931678299b9b659472772b2550b703f41c"
    },
    "commitTxHash": "0x0dcaca926bdd167490dba5a3fd5a9827ee91be985b09d69d7ed1e7bd3897604f",
    "committedAt": "2023-02-17T02:13:38.908944Z",
    "executeTxHash": "0x156e7ea92b74b4fb73746bcc1b4d64189fa4048a5139793ace91f1c0d01393ca",
    "executedAt": "2023-02-17T05:13:17.762256Z",
    "fairPubdataPrice": null,
    "l1GasPrice": 47683924811,
    "l1TxCount": 1,
    "l2FairGasPrice": 250000000,
    "l2TxCount": 1,
    "number": 28,
    "proveTxHash": "0x83dcb7d938bc2e47e5dc46c2bffc5211679af1af7d83386148229e6d84ae5e99",
    "provenAt": "2023-02-17T02:13:38.950091Z",
    "rootHash": "0xf7876070f823962eb7ca7bd5496f85daf7a13481db2ce47d78baf1e04375038a",
    "status": "verified",
    "timestamp": 1676592735
  },
  "id": 1
}

zks_getL1BatchBlockRange

Returns the range of blocks contained within a batch given by the batch number.

The range is provided by the beginning and end block numbers in hexadecimal.

Parameters

L1BatchNumber - the layer 1 batch number.

Returns

Array of Hex Strings - array containing the beginning and end block numbers in hexadecimal.

Example Request

curl --request POST \
--url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getL1BatchBlockRange",
      "params": [28]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": [
    "0x105ab",
    "0x118ac"
  ],
  "id": 1
}

zks_getL1GasPrice

Retrieves the current L1 gas price.

Parameters

None

Returns

QUANTITY, 8 bytes - current L1 gas price in hexadecimal format, representing the amount of wei per unit of gas.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getL1GasPrice",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": "0xc3e07ded",
  "id": 1
}

zks_getFeeParams

Retrieves the current fee parameters.

Parameters

None

Returns

Object

  • V2: Object - fee parameter configuration for the current version of the Cronos zkEVM protocol.

  • config: Object - settings related to transaction fee computation.

  • minimal_l2_gas_price: uint64 - minimal gas price on L2.

  • compute_overhead_part: float64 - compute overhead part in fee calculation.

  • pubdata_overhead_part: float64 - public data overhead part in fee calculation.

  • batch_overhead_l1_gas: uint64 - overhead in L1 gas for a batch of transactions.

  • max_gas_per_batch: uint64 - maximum gas allowed per batch.

  • max_pubdata_per_batch: uint64 - maximum amount of public data allowed per batch.

  • l1_gas_price: uint64 - current L1 gas price.

  • l1_pubdata_price: uint64 - price of storing public data on L1.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getFeeParams",
      "params": ["0x53fb3c6e14ff461f30382f5dc8f648286559cd1f58e75e12ce51db33da7bc6e0"]
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "V2": {
      "config": {
        "minimal_l2_gas_price": 2500000000000,
        "compute_overhead_part": 0.0,
        "pubdata_overhead_part": 0.0,
        "batch_overhead_l1_gas": 750000,
        "max_gas_per_batch": 200000000,
        "max_pubdata_per_batch": 750000
      },
      "l1_gas_price": 2264991746,
      "l1_pubdata_price": 0,
      "conversion_ratio": {
        "numerator": 1,
        "denominator": 1
      }
    }
  },
  "id": 1
}

zks_getProtocolVersion

Gets the protocol version.

Parameter

uint16 - Optional. Specific version ID.

Returns

Object

  • version_id: uint16 - protocol version ID.

  • timestamp: uint64 - Unix timestamp of the version's activation.

  • verification_keys_hashes: Object - Contains the hashes of various verification keys used in the protocol.

  • base_system_contracts: Object - Hashes of the base system contracts, like the bootloader and default account abstraction (AA).

  • l2_system_upgrade_tx_hash: DATA, 32 bytes - hash of the transaction used for the system upgrade, if any.

Example Request

curl --request POST \
  --url https://mainnet.zkevm.cronos.org \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "zks_getProtocolVersion",
      "params": []
    }'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "version_id": 24,
    "minorVersion": 24,
    "timestamp": 0,
    "verification_keys_hashes": {
      "params": {
        "recursion_node_level_vk_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "recursion_leaf_level_vk_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "recursion_circuits_set_vks_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      "recursion_scheduler_level_vk_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
    },
    "base_system_contracts": {
      "bootloader": "0x010008e742608b21bf7eb23c1a9d0602047e3618b464c9b59c0fba3b3d7ab66e",
      "default_aa": "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32"
    },
    "bootloaderCodeHash": "0x010008e742608b21bf7eb23c1a9d0602047e3618b464c9b59c0fba3b3d7ab66e",
    "defaultAccountCodeHash": "0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32",
    "l2_system_upgrade_tx_hash": "0xd05d194051ec55ccc2207d19499a7959c87327586d85b0914684b0f3319cbeff",
    "l2SystemUpgradeTxHash": "0xd05d194051ec55ccc2207d19499a7959c87327586d85b0914684b0f3319cbeff"
  },
  "id": 1
}

Last updated