Supported on zkSync (mainnet) only.
API Endpoint
The format of a zkSync API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/zksync/
Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/zksync/
zkSync JSON-RPC API
zks_estimateFee
Returns the fee for the transaction.
Parameters
from
- string - The address from which the transaction is sentto
- string - The address to which the transaction is addresseddata
- string - The hash of the block
Returns
gas_limit
- The maximum amount of gas that the transaction is allowed to consumegas_per_pubdata_limit
- The amount of gas that is consumed per public data bytemax_fee_per_gas
- The maximum fee (measured in wei) that can be paid per gas unitmax_priority_fee_per_gas
- The maximum priority fee (measured in wei) that can be paid per gas unit
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_estimateFee","params":[{ "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ],"id":1,"jsonrpc":"2.0"}'
zks_estimateGasL1ToL2
Returns an estimate of the gas required for a L1 to L2 transaction.
Parameters
from
- string - The address from which the transaction is sentto
- string - The address to which the transaction is addresseddata
- string - The data associated with the transaction
Returns
result
- The estimate of the gas required for a L1 to L2 transaction
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_estimateGasL1ToL2","params":[{ "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ],"id":1,"jsonrpc":"2.0"}'
zks_getAllAccountBalances
Returns all balances for confirmed tokens given by an account address.
Parameters
address
- string - The account address
Returns
address
- The address for which the balances are being returnedbalance
- The account balance represented in hexadecimal format
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getAllAccountBalances","params":["0x98E9D288743839e96A8005a6B51C770Bbf7788C0" ],"id":1,"jsonrpc":"2.0"}'
zks_getBlockDetails
Returns additional zkSync-specific information about the L2 block.
Parameters
block
- string - The number of the block
Returns
baseSystemContractsHashes
- object - An object containing hashes of the base system contracts used in the transactionbootloader
- The hash of the bootloader contractdefault_aa
- The hash of the default account contract
commitTxHash
- The hash of the transaction committed to the networkcommittedAt
- The timestamp when the transaction was committed to the networkexecuteTxHash
- The hash of the transaction executed on the networkexecutedAt
- The timestamp when the transaction was executed on the networkl1BatchNumber
- The batch number of the transaction on the L1 (Ethereum) networkl1GasPrice
- The gas price used for the transaction on the L1 networkl1TxCount
- The number of transactions related to this batch on the L1 networkl2FairGasPrice
- The fair gas price used for the transaction on the L2 (zkSync) networkl2TxCount
- The total number of transactions on the L2 networknumber
- The transaction numberoperatorAddress
- The address of the operator who executed the transactionproveTxHash
- The hash of the proof transaction on the L1 networkprovenAt
- The timestamp when the proof transaction was done on the L1 networkrootHash
- The root hash representing the state of the network after the transactionstatus
- The status of the transactiontimestamp
- The timestamp of the transaction
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getBlockDetails","params":[140599],"id":1,"jsonrpc":"2.0"}'
zks_getBridgeContracts
Returns L1/L2 addresses of default bridges.
Parameters
- N/A
Returns
l1Erc20DefaultBridge
- The address of the default bridge contract responsible for handling ERC-20 token transfers from the L1 network to the L2 networkl2Erc20DefaultBridge
- The address of the default bridge contract responsible for handling ERC-20 token transfers from the L2 network to the L1 network
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getBridgeContracts","params":[ ],"id":1,"jsonrpc":"2.0"}'
zks_getBytecodeByHash
Returns bytecode of a transaction given by its hash.
Parameters
hash
- string - The hash os the transaction
Returns
result
- The byte code of the given transaction
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getBytecodeByHash","params":["0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc" ],"id":1,"jsonrpc":"2.0"}'
zks_getConfirmedTokens
Returns information of all tokens within a given range.
Parameters
from
- integer - The token id from which to start returning the information about the tokenslimit
- integer - The number of token to be returned
Returns
result
- array - The result array which has the list of all token which contains the following fields:decimals
- The number of decimal places for the tokenl1Address
- The address of the token on the L1 networkl2Address
- The address of the token on the L2 networkname
- The name of the tokensymbol
- The symbol or ticker of the token
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getConfirmedTokens","params":[1, 3 ],"id":1,"jsonrpc":"2.0"}'
zks_getL1BatchBlockRange
Returns the range of blocks contained within a batch identified by its batch number.
Parameters
batch
- integer - The layer 1 batch number
Returns
result
- The range of blocks contained within a given batch. The range is given by beginning/end block numbers in hexadecimal format
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getL1BatchBlockRange","params":[12345 ],"id":1,"jsonrpc":"2.0"}'
zks_getL1BatchDetails
Returns data pertaining to a given batch.
Parameters
batch
- integer - The layer 1 batch number
Returns
baseSystemContractsHashes
- object - An object containing hashes of the base system contracts used in the transactionbootloader
- The hash of the bootloader contractdefault_aa
- The hash of the default account contract
commitTxHash
- The hash of the transaction committed to the networkcommittedAt
- The timestamp when the transaction was committed to the networkexecuteTxHash
- The hash of the transaction executed on the networkexecutedAt
- The timestamp when the transaction was executed on the networkl1BatchNumber
- The batch number of the transaction on the L1 (Ethereum) networkl1GasPrice
- The gas price used for the transaction on the L1 networkl1TxCount
- The number of transactions related to this batch on the L1 networkl2FairGasPrice
- The fair gas price used for the transaction on the L2 (zkSync) networkl2TxCount
- The total number of transactions on the L2 networknumber
- The transaction numberoperatorAddress
- The address of the operator who executed the transactionproveTxHash
- The hash of the proof transaction on the L1 networkprovenAt
- The timestamp when the proof transaction was done on the L1 networkrootHash
- The root hash representing the state of the network after the transactionstatus
- The status of the transactiontimestamp
- The timestamp of the transaction
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getL1BatchDetails","params":[12345 ],"id":1,"jsonrpc":"2.0"}'
zks_getL2ToL1LogProof
Returns the proof for the corresponding L2 to L1 log, given a transaction hash and the index of the L2 to L1 log produced within the transaction.
Parameters
tx_hash
- string - The hash of the L2 transactionl2_to_l1_log_index
- integer - The index of the L2 to L1 log in the transaction
Returns
id
- The position of the leaf in the Merkle tree of L2->L1 messages for the blockproof
- The Merkle proof for the messageroot
- The root hash representing the Merkle tree root at the time the L2 to L1 log was generated
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getL2ToL1LogProof","params":["0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e" ],"id":1,"jsonrpc":"2.0"}'
zks_getL2ToL1MsgProof
Returns the proof for a message sent via the L1Messenger system contract, given a block, sender, message, and an optional message log index containing the L1->L2 message.
Parameters
block
- integer - The number of the block where the message was emittedsender
- string - The sender of the messagemsg
- string - The keccak256 hash of the sent messagel2_log_position
- string - The index in the block of the event that was emitted by the L1Messenger when submitting this message
Returns
id
- The position of the leaf in the Merkle tree of L2->L1 messages for the blockproof
- The Merkle proof for the messageroot
- The root hash representing the Merkle tree root at the time the L2 to L1 log was generated
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getL2ToL1MsgProof","params":[5187, "0x87869cb87c4Fa78ca278dF358E890FF73B42a39E", "0x22de7debaa98758afdaee89f447ff43bab5da3de6acca7528b281cc2f1be2ee9" ],"id":1,"jsonrpc":"2.0"}'
zks_getMainContract
Returns the address of the zkSync Era contract.
Parameters
- N/A
Returns
result
- The address of the zkSync Era contract
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getMainContract","params":[],"id":1,"jsonrpc":"2.0"}'
zks_getRawBlockTransactions
Returns data of transactions in a block.
Parameters
block
- integer - The block number
Returns
common_data
- object - An object containing common data related to the executed transactionL1
- object - An object containing information about the corresponding transaction on the L1 networkcanonicalTxHash
- The canonical hash of the transaction on the L1 networkdeadlineBlock
- The deadline block for the transaction on the L1 networkethBlock
- The Ethereum block number for the transactionethHash
- The Ethereum transaction hash for the transactionfullFee
- The full fee for the transaction in hexadecimal formatgasLimit
- The gas limit for the transaction in hexadecimal formatgasPerPubdataLimit
- The gas per public data limit for the transaction in hexadecimal formatlayer2TipFee
- The tip fee for the transaction on the L2 network in hexadecimal formatmaxFeePerGas
- The maximum fee per gas for the transaction in hexadecimal formatopProcessingType
- The type of operation processing used for the transactionpriorityQueueType
- The type of priority queue used for the transactionrefundRecipient
- The recipient address for any potential refund for the transactionsender
- The sender address of the transactionserialId
- The serial ID of the transactiontoMint
- The address to mint tokens for the transaction
execute
- object - An object containing information about the execution of the transactioncalldata
- The calldata for the execution in hexadecimal formatcontractAddress
- The contract address for the executionfactoryDeps
- An array containing factory dependencies for the executionvalue
- The value for the execution in hexadecimal format
received_timestamp_ms
- The timestamp when the transaction was received
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getRawBlockTransactions","params":[5817],"id":1,"jsonrpc":"2.0"}'
zks_getTestnetPaymaster
Returns the address of the testnet paymaster, which is available on testnets and facilitates fee payments in ERC-20 compatible tokens.
Parameters
- N/A
Returns
result
- The address of the testnet paymaster, which is available on testnets and facilitates fee payments in ERC-20 compatible tokens
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getTestnetPaymaster","params":[],"id":1,"jsonrpc":"2.0"}'
zks_getTokenPrice
Returns the price of a given token in USD.
Parameters
address
- string - The address of the token
Returns
result
- The price of a given token in USD
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getTokenPrice","params":["0x0000000000000000000000000000000000000000" ],"id":1,"jsonrpc":"2.0"}'
zks_getTransactionDetails
Returns data from a specific transaction identified by its transaction hash.
Parameters
hash
- string - The transaction hash encoded in hexadecimal format
Returns
ethCommitTxHash
- The transaction hash of the commit transactionethExecuteTxHash
- The transaction hash of the execute transactionethProveTxHash
- The Ethereum transaction hash of the proof transactionfee
- The fee amount for the transaction in hexadecimal formatgasPerPubdata
- The gas per public data for the transaction in hexadecimal formatinitiatorAddress
- The ddress of the transaction initiatorisL1Originated
- A boolean flag indicating whether the transaction originated from L1 networkreceivedAt
- The timestamp when the transaction was received on the L2 networkstatus
- The status of the transaction
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_getTransactionDetails","params":["0x60944a2b978561ba6b0b1962fec4f51c80402b8aa61c07b8879233d34a8f7775" ],"id":1,"jsonrpc":"2.0"}'
zks_L1BatchNumber
Returns the latest L1 batch number.
Parameters
- N/A
Returns
result
- The latest L1 batch number
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_L1BatchNumber","params":[ ],"id":1,"jsonrpc":"2.0"}'
zks_L1ChainId
Returns the chain id of the underlying L1.
Parameters
- N/A
Returns
result
- The chain id of the underlying L1
Example
curl https://open-platform.nodereal.io/{{apiKey}}/zksync/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zks_L1ChainId","params":[],"id":1,"jsonrpc":"2.0"}'