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

Gravity — eth, debug

API reference for Gravity. All methods ->

eth_getUncleByBlockNumberAndIndex

Returns information about an uncle of a block by number and uncle index position.

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> (quantity|tag): either the hex value of a block number or one of the following block tags:
      • earliest: the lowest numbered block available on the client.
      • finalized: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.
      • safe: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.
      • pending: a sample next block built by the client on top of the latest and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
    2. <string> (quantity): the uncle's index position.

Returns


  • <object>: a block object, or null when no block was found:
    • number (string; quantity): the block number; null when it's a pending block.
    • hash (string; data, 32 bytes): the hash of the block; null when it's a pending block.
    • parentHash (string; data, 32 bytes): the hash of the parent block.
    • nonce (string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.
    • sha3Uncles (string; data, 32 bytes): SHA3 of the uncles data in the block.
    • logsBloom (string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.
    • transactionsRoot (string; data, 32 bytes): the root of the transaction trie of the block.
    • stateRoot (string; data, 32 bytes): the root of the final state trie of the block.
    • receiptsRoot (string; data, 32 bytes): the root of the receipts trie of the block.
    • miner (string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.
    • difficulty (string; quantity): the difficulty for this block.
    • totalDifficulty (string; quantity): the total difficulty of the chain until this block.
    • extraData (string; data): the extra data field of this block.
    • size (string; quantity): the size of this block in bytes.
    • gasLimit (string; quantity): the maximum gas allowed in this block.
    • gasUsed (string; quantity): the total used gas by all transactions in this block.
    • timestamp (string; quantity): the unix timestamp for when the block was collated.
    • transactions (array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.
    • uncles (array of strings): an array of uncle hashes.

Request example

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

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": null
}

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/gravity/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x1E8480",
"toBlock": "0x1E8481",
"address": "0xb2D0A71509A77E7A4B485E40882997701A3554b8",
"topics": []
}],
"id": 1
}'

Response example

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

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 Gravity blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

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

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txHash": "0x6d45a4e56001af4c5b92ff6859ee10a81555c5c9d24df6d33af899b8673e6c66",
"result": {
"beforeEVMTransfers": [],
"afterEVMTransfers": [],
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasUsed": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"input": "0x6bf6a42d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001391c0c0000000000000000000000000000000000000000000000000000000000029e280000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0",
"type": "CALL"
}
}
]
}

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 Gravity blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

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

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txHash": "0x6d45a4e56001af4c5b92ff6859ee10a81555c5c9d24df6d33af899b8673e6c66",
"result": {
"beforeEVMTransfers": [],
"afterEVMTransfers": [],
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasUsed": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"input": "0x6bf6a42d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001391c0c0000000000000000000000000000000000000000000000000000000000029e280000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0",
"type": "CALL"
}
}
]
}

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 Gravity blockchain documentation to get detailed information on additional or custom tracers that may be supported.

Request example

curl -X POST https://rpc.ankr.com/gravity/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"
}
]
}
]
}