For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

zkSync Era — eth, debug

API reference for zkSync Era. All methods ->

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

The receipt is not available for pending transactions.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a hash of the transaction.

Returns

  • object: a transaction receipt object, or null when no receipt was found:

    • transactionHash (string; data, 32 bytes): a hash of the transaction.

    • transactionIndex (string; quantity): the transactions index position in the block.

    • blockHash (string; data, 32 bytes): a hash of the block containing the transaction.

    • blockNumber (string; quantity): a number of the block containing the transaction.

    • from (string; data, 20 bytes): an address of the sender.

    • to (string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction.

    • cumulativeGasUsed (string; quantity): the total amount of gas used when this transaction was executed in the block.

    • effectiveGasPrice (string; quantity): the sum of the base fee and tip paid per unit of gas.

    • gasUsed (string; quantity): the amount of gas used by this specific transaction alone.

    • contractAddress (string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null.

    • logs (array): an array of log objects, which this transaction generated.

    • logsBloom (string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs.

    • type (string; data): the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees. It also returns either of the following:

      • root (string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).
      • status (string; quantity): either 1 (success) or 0 (failure).

Request example

curl -X POST https://rpc.ankr.com/zksync_era/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xa9af72199b085387a4103b267b0329155fc9bfe052a897400be45193df01bf36"],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"result": {
"blockHash": "0xeb83cac74ab6c6ba55548bb4789d15c6c795f63e7aa1d8c185712e3531fa004a",
"blockNumber": "0x5aca5d",
"contractAddress": null,
"cumulativeGasUsed": "0x0",
"effectiveGasPrice": "0xee6b280",
"from": "0x8f28567e1ac98b67f0eecc00c3448543681b5d89",
"gasUsed": "0xa1b12",
"l1BatchNumber": "0xfe7a",
"l1BatchTxIndex": "0x1b8",
"l2ToL1Logs": [],
"logs": [
{
"address": "0x000000000000000000000000000000000000800a",
"blockHash": "0xeb83cac74ab6c6ba55548bb4789d15c6c795f63e7aa1d8c185712e3531fa004a",
"blockNumber": "0x5aca5d",
"data": "0x00000000000000000000000000000000000000000000000000038d7ea4c68000",
"l1BatchNumber": "0xfe7a",
"logIndex": "0x37",
"logType": null,
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008f28567e1ac98b67f0eecc00c3448543681b5d89",
"0x0000000000000000000000000000000000000000000000000000000000008001"
],
"transactionHash": "0xa9af72199b085387a4103b267b0329155fc9bfe052a897400be45193df01bf36",
"transactionIndex": "0x9",
"transactionLogIndex": "0x37"
}
],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"root": "0xeb83cac74ab6c6ba55548bb4789d15c6c795f63e7aa1d8c185712e3531fa004a",
"status": "0x1",
"to": "0x2da10a1e27bf85cedd8ffb1abbe97e53391c0295",
"transactionHash": "0xa9af72199b085387a4103b267b0329155fc9bfe052a897400be45193df01bf36",
"transactionIndex": "0x9",
"type": "0x0"
},
"id": 1
}

eth_getLogs

Returns an array of all logs matching a given filter object.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. object: the filter options:

      • fromBlock (string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:

        • latest: for the last mined block.
        • earliest: for the lowest numbered block available on the client.
        • pending: for not yet mined transactions.
      • toBlock (string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:

        • latest: for the last mined block.
        • earliest: for the lowest numbered block available on the client.
        • pending: for not yet mined transactions.
      • address (array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate.

      • topics (array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options.

      • blockhash (string; data, 32 bytes; optional; future): with the addition of EIP-234, blockHash will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.

Returns

  • removed (string; tag): true when the log was removed, due to a chain reorganization; false if it's a valid log.
  • logIndex (string; quantity): the log index position in the block; null when it's a pending log.
  • transactionIndex (string; quantity): the transactions index position log was created from; null when it's a pending log.
  • transactionHash (string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.
  • blockHash (string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.
  • blockNumber (string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.
  • address (string; data, 20 bytes): an address from which this log originated.
  • data (string; data): contains one or more 32 bytes non-indexed arguments of the log.
  • topics (array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)

Request example

curl -X POST https://rpc.ankr.com/zksync_era/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"address": "0x8F28567e1aC98B67F0eEcC00c3448543681b5D89"}],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000009acbb72cf67103a30333a32cd203459c6a9c3311",
"0x000000000000000000000000994871e1103c5da4be270365fa62771ea4525520"
],
"data": "0x000000000000000000000000000000000000000000000000000000001ec39aa0",
"blockNumber": "0xf6289d",
"transactionHash": "0xc7ed73c9b219d4243872e5993ad2950c8ea87d15af28562d33b0c05d46a90cee",
"transactionIndex": "0x1e",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x13",
"removed": false
},
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000005879975799597392c031f10b6eff282cb7974ac8",
"0x0000000000000000000000006d52ab66340f3f78d0c1007bec484268876b5948"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0xf6289d",
"transactionHash": "0x0118499f7be4c3510bd60fe3a3aee5f5f316743b6cc13a8cb0528d784f962aec",
"transactionIndex": "0x20",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x14",
"removed": false
}
]
}

debug_traceBlockByHash

Traces the execution of all transactions within a block specified by hash.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <blockHash> (string; required): the hash of the block you want to trace.
    • tracer (string; optional): the tracer to use for the operation. Tracers can customize the output, for example, by including only certain types of operations. Common tracers are the following:
      • callTracer: generates a detailed trace of all calls, including internal contract calls. callTracer has the following parameters:
        • onlyTopCall (boolean): if true, only the top-level call is traced.
        • tracerConfig (object): additional options to customize the output, such as including or excluding specific call types.
      • prestateTracer: traces the state of accounts before the execution of transactions.
      • noopTracer: a no-operation tracer that returns minimal information.
      • fourByteTracer: identifies the function signature of calls by analyzing the first four bytes of the calldata.
      • memoryTracer: traces memory changes during the execution of transactions. memoryTracer has the following parameters:
        • disableMemory (boolean): if true, memory output is omitted.
      • opTracer: traces all the EVM opcodes executed during a transaction. opTracer has the following parameters:
        • includeMemory (boolean): if true, includes memory output.
        • includeStack (boolean): if true, includes stack output.
        • includeStorage (boolean): if true, includes storage output.
      • gasTracer: traces the gas usage of the transaction and breaks it down by operation.
    • timeout (optional, string): sets a timeout for the tracing operation, expressed in milliseconds (e.g., "5s" for 5 seconds). If the operation exceeds this time, it will be terminated.
    • tracingOptions (optional, object): an object to specify additional options for the trace, such as:
      • disableMemory (boolean): if true, memory output is omitted.
      • disableStack (boolean): if true, stack output is omitted.
      • disableStorage (boolean): if true, storage output is omitted.

You can create custom tracers by combining existing tracer parameters or defining new ones. The flexibility of tracers allows you to tailor the debugging output to your specific needs, focusing on different aspects of transaction execution.

If you're working on specific use cases, it may be helpful to look into the zkSync Era blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

curl -X POST https://rpc.ankr.com/zksync_era_sepolia/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0x8c2f6fd9c2db9f21c801ed1aa7a2ebe24ed51a90aac8035e3ba176e195cb3c1d",
{
"tracer": "callTracer",
"timeout": "5s",
"tracingOptions": {
"disableMemory": true,
"disableStack": true,
"disableStorage": false
}
}
],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"result": {
"type": "CALL",
"from": "0x44988098726e23c1f81d5ff3847d37709f69263a",
"to": "0xda879470d70845da9efbd4884c8149a6df4e50a1",
"value": "0x0",
"gas": "0xc881",
"gasUsed": "0x8535",
"input": "0x68573107000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000300000000000000000000000043ad4c4aed53558261d1aeb2bbc6acde89dbe6b30000000000000000000000005fd5de01554c302d0fb66a35684e023de8e87be2000000000000000000000000c186130e7b46c65a14695f8bfde8a31734b3aab4000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000014d1120d7b16000000000000000000000000000000000000000000000000000014d1120d7b16000000000000000000000000000000000000000000000000000014d1120d7b160000",
"output": "0x"
}
},
{
"result": {
"type": "CALL",
"from": "0xd9cd9ec80463c5928575d7c397374a5dcff01fb7",
"to": "0xda879470d70845da9efbd4884c8149a6df4e50a1",
"value": "0x0",
"gas": "0x76e3",
"gasUsed": "0x4773",
"input": "0x68573107000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b562cd54681d9c400d46a1b52f9435fdf8dc6b83000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000014d1120d7b160000",
"output": "0x"
}
}
]
}

debug_traceBlockByNumber

Traces the execution of all transactions within a block specified by number.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <blockNumber> (string; hex; required): the hex number of the block you want to trace.
    • tracer (string; optional): the tracer to use for the operation. Tracers can customize the output, for example, by including only certain types of operations. Common tracers are the following:
      • callTracer: generates a detailed trace of all calls, including internal contract calls. callTracer has the following parameters:
        • onlyTopCall (boolean): if true, only the top-level call is traced.
        • tracerConfig (object): additional options to customize the output, such as including or excluding specific call types.
      • prestateTracer: traces the state of accounts before the execution of transactions.
      • noopTracer: a no-operation tracer that returns minimal information.
      • fourByteTracer: identifies the function signature of calls by analyzing the first four bytes of the calldata.
      • memoryTracer: traces memory changes during the execution of transactions. memoryTracer has the following parameters:
        • disableMemory (boolean): if true, memory output is omitted.
      • opTracer: traces all the EVM opcodes executed during a transaction. opTracer has the following parameters:
        • includeMemory (boolean): if true, includes memory output.
        • includeStack (boolean): if true, includes stack output.
        • includeStorage (boolean): if true, includes storage output.
      • gasTracer: traces the gas usage of the transaction and breaks it down by operation.
    • timeout (optional, string): sets a timeout for the tracing operation, expressed in milliseconds (e.g., "5s" for 5 seconds). If the operation exceeds this time, it will be terminated.
    • tracingOptions (optional, object): an object to specify additional options for the trace, such as:
      • disableMemory (boolean): if true, memory output is omitted.
      • disableStack (boolean): if true, stack output is omitted.
      • disableStorage (boolean): if true, storage output is omitted.

You can create custom tracers by combining existing tracer parameters or defining new ones. The flexibility of tracers allows you to tailor the debugging output to your specific needs, focusing on different aspects of transaction execution.

If you're working on specific use cases, it may be helpful to look into the zkSync Era blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

curl -X POST https://rpc.ankr.com/zksync_era_sepolia/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByNumber",
"params": [
"0x37117D",
{
"tracer": "callTracer",
"timeout": "5s",
"tracingOptions": {
"disableMemory": true,
"disableStack": true,
"disableStorage": false
}
}
],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"result": {
"type": "CALL",
"from": "0x86fda994a63d7917d2a447ceeaa917f2a7dffb8e",
"to": "0xda879470d70845da9efbd4884c8149a6df4e50a1",
"value": "0x0",
"gas": "0x76e3",
"gasUsed": "0x4773",
"input": "0x68573107000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a90b4e7c457b810f52602ee72d2e3508d1a93935000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000014d1120d7b160000",
"output": "0x"
}
},
{
"result": {
"type": "CALL",
"from": "0xab181fdbe661c32b83a942a6c9d076f1bc217e1e",
"to": "0xda879470d70845da9efbd4884c8149a6df4e50a1",
"value": "0x0",
"gas": "0x76e3",
"gasUsed": "0x4773",
"input": "0x68573107000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000589d348d26c107a0fac86dc0096a7af308af189200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008ac7230489e80000",
"output": "0x"
}
}
]
}

debug_traceBlock

Traces the execution of all transactions within a block.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <blockRlp> (string; hex; required): the RLP-encoded data of the block you want to trace.
    • tracer (string; optional): the tracer to use for the operation. Tracers can customize the output, for example, by including only certain types of operations. Common tracers are the following:
      • callTracer: generates a detailed trace of all calls, including internal contract calls. callTracer has the following parameters:
        • onlyTopCall (boolean): if true, only the top-level call is traced.
        • tracerConfig (object): additional options to customize the output, such as including or excluding specific call types.
      • prestateTracer: traces the state of accounts before the execution of transactions.
      • noopTracer: a no-operation tracer that returns minimal information.
      • fourByteTracer: identifies the function signature of calls by analyzing the first four bytes of the calldata.
      • memoryTracer: traces memory changes during the execution of transactions. memoryTracer has the following parameters:
        • disableMemory (boolean): if true, memory output is omitted.
      • opTracer: traces all the EVM opcodes executed during a transaction. opTracer has the following parameters:
        • includeMemory (boolean): if true, includes memory output.
        • includeStack (boolean): if true, includes stack output.
        • includeStorage (boolean): if true, includes storage output.
      • gasTracer: traces the gas usage of the transaction and breaks it down by operation.
    • timeout (optional, string): sets a timeout for the tracing operation, expressed in milliseconds (e.g., "5s" for 5 seconds). If the operation exceeds this time, it will be terminated.
    • tracingOptions (optional, object): an object to specify additional options for the trace, such as:
      • disableMemory (boolean): if true, memory output is omitted.
      • disableStack (boolean): if true, stack output is omitted.
      • disableStorage (boolean): if true, storage output is omitted.

You can create custom tracers by combining existing tracer parameters or defining new ones. The flexibility of tracers allows you to tailor the debugging output to your specific needs, focusing on different aspects of transaction execution.

If you're working on specific use cases, it may be helpful to look into the zkSync Era blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

curl -X POST https://rpc.ankr.com/zksync_era_sepolia/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "debug_traceBlock",
"params": [
"blockRlp",
{
"tracer": "tracerType",
"timeout": "timeoutDuration",
"tracingOptions": {
"disableMemory": boolean,
"disableStack": boolean,
"disableStorage": boolean
}
}
],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"type": "call",
"from": "0x1234...abcd", // Address initiating the transaction
"to": "0xabcd...1234", // Address receiving the transaction
"gas": "0x5208", // Gas provided for the transaction
"gasUsed": "0x2100", // Gas actually used during execution
"input": "0x...", // Input data to the transaction (usually calldata)
"output": "0x...", // Output data from the transaction (e.g., return data)
"value": "0x0", // Value transferred in the transaction (in wei)
"calls": [ // Nested calls (if any)
{
"type": "call",
"from": "0xabcd...1234",
"to": "0x1234...abcd",
"gas": "0x5208",
"gasUsed": "0x2100",
"input": "0x...",
"output": "0x...",
"value": "0x0"
}
]
}
]
}