qan_getLogs

post

https://rpc-testnet.qanplatform.com/getLogs/

API details

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

Request body for "qan_getLogs"

Addressstring

The contract address or a list of addresses from which logs should originate

BlockHashstring

With the addition of EIP-234, blockHash is a new filter option that restricts the logs returned to the block number referenced in the blockHash. Using the blockHash field is equivalent to setting the fromBlock and toBlock to the block number the blockHash references. If blockHash is present in the filter criteria, neither fromBlock nor toBlock is allowed

FromBlockstring

The block number as a string in decimal format or tags. The supported tag values include earliest for the earliest/genesis block, latest for the latest mined block, pending for the pending state/transactions.

ToBlockstring

The block number as a string in decimal format or tags. The supported tag values include earliest for the earliest/genesis block, latest for the latest mined block, pending for the pending state/transactions.

Topicsarray[string]

An array of DATA topics and also, the topics are order-dependent. Visit this official page to learn more about topics

HTTP response status codes for "qan_getLogs"

Status Code Description
200 OK
400 Bad Request
404 Not Found
422 Unprocessable Entity
500 Internal Server Error

Code samples for "qan_getLogs"

Request examples

post

https://rpc-testnet.qanplatform.com/getLogs/

cURLJavaScriptGoPythonJava
curl --request POST \
  --url https://rpc-testnet.qanplatform.com/getLogs/ \
  --header 'Accept: application/json, application/problem+json' \
  --header 'Content-Type: application/json' \
  --data '
{
"Address": "string",
"BlockHash": "string",
"FromBlock": "string",
"ToBlock": "string",
"Topics": []
}
'
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json, application/problem+json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    Address: 'string',
    BlockHash: 'string',
    FromBlock: 'string',
    ToBlock: 'string',
    Topics: []
  })
};

fetch('https://rpc-testnet.qanplatform.com/getLogs/', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://rpc-testnet.qanplatform.com/getLogs/"

  payload := strings.NewReader("{\"Address\":\"string\",\"BlockHash\":\"string\",\"FromBlock\":\"string\",\"ToBlock\":\"string\",\"Topics\":[]}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Accept", "application/json, application/problem+json")
  req.Header.Add("Content-Type", "application/json")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)

  fmt.Println(string(body))

}
import requests

url = "https://rpc-testnet.qanplatform.com/getLogs/"

payload = {
  "Address": "string",
  "BlockHash": "string",
  "FromBlock": "string",
  "ToBlock": "string",
  "Topics": []
}
headers = {
  "Accept": "application/json, application/problem+json",
  "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
HttpResponse<String> response = Unirest.post("https://rpc-testnet.qanplatform.com/getLogs/")
  .header("Accept", "application/json, application/problem+json")
  .header("Content-Type", "application/json")
  .body("{\"Address\":\"string\",\"BlockHash\":\"string\",\"FromBlock\":\"string\",\"ToBlock\":\"string\",\"Topics\":[]}")
  .asString();

Responses

200400404422500

Description: OK

Content type: application/json

Example

{
  "$schema": "https://rpc-testnet.qanplatform.com/schemas/Output_getLogs.json",
  "Logs": []
}

Body

$schemastring<uri>

A URL to the JSON Schema for this object.

Example:https://rpc-testnet.qanplatform.com/schemas/Output_getLogs.json

Logsarray[object]Required

An array of log objects, or an empty array if nothing has changed since last poll

Addressstring

An address from which this log originated

BlockHashstring,null

The hash of the block where this log was in. null when its a pending log

BlockNumberstring,null

The block number where this log was in. null when its a pending log

Datastring

It contains one or more 32 Bytes non-indexed arguments of the log

LogIndexstring,null

The integer of the log index position in the block. null when its a pending log

Removedboolean

It is true when the log was removed due to a chain reorganization, and false if it's a valid log

Topicsarray[string]

An array of zero to four 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 declare the event with the anonymous specifier

TransactionHashstring,null

The hash of the transactions this log was created from. null when its a pending log

TransactionIndexstring,null

The integer of the transaction's index position that the log was created from. null when it's a pending log

Description: Bad Request

Content type: application/problem+json

Example

{
  "$schema": "https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Body

$schemastring<uri>

A URL to the JSON Schema for this object.

Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json

detailstring

A human-readable explanation specific to this occurrence of the problem.

Example:Property foo is required but is missing.

errorsarray[object]

Optional list of individual error details

locationstring

Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'

messagestring

Error message text

valueany

The value at the given location

instancestring<uri>

A URI reference that identifies the specific occurrence of the problem.

Example:https://example.com/error-log/abc123

statusinteger<int64>

HTTP status code

Example:400

titlestring

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

Example:Bad Request

typestring<uri>

A URI reference to human-readable documentation for the error.

Default:about:blank

Example:https://example.com/errors/example

Description: Not Found

Content type: application/problem+json

Example

{
  "$schema": "https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Body

$schemastring<uri>

A URL to the JSON Schema for this object.

Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json

detailstring

A human-readable explanation specific to this occurrence of the problem.

Example:Property foo is required but is missing.

errorsarray[object]

Optional list of individual error details

locationstring

Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'

messagestring

Error message text

valueany

The value at the given location

instancestring<uri>

A URI reference that identifies the specific occurrence of the problem.

Example:https://example.com/error-log/abc123

statusinteger<int64>

HTTP status code

Example:400

titlestring

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

Example:Bad Request

typestring<uri>

A URI reference to human-readable documentation for the error.

Default:about:blank

Example:https://example.com/errors/example

Description: Unprocessable Entity

Content type: application/problem+json

Example

{
  "$schema": "https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Body

$schemastring<uri>

A URL to the JSON Schema for this object.

Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json

detailstring

A human-readable explanation specific to this occurrence of the problem.

Example:Property foo is required but is missing.

errorsarray[object]

Optional list of individual error details

locationstring

Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'

messagestring

Error message text

valueany

The value at the given location

instancestring<uri>

A URI reference that identifies the specific occurrence of the problem.

Example:https://example.com/error-log/abc123

statusinteger<int64>

HTTP status code

Example:400

titlestring

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

Example:Bad Request

typestring<uri>

A URI reference to human-readable documentation for the error.

Default:about:blank

Example:https://example.com/errors/example

Description: Internal Server Error

Content type: application/problem+json

Example

{
  "$schema": "https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Body

$schemastring<uri>

A URL to the JSON Schema for this object.

Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json

detailstring

A human-readable explanation specific to this occurrence of the problem.

Example:Property foo is required but is missing.

errorsarray[object]

Optional list of individual error details

locationstring

Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'

messagestring

Error message text

valueany

The value at the given location

instancestring<uri>

A URI reference that identifies the specific occurrence of the problem.

Example:https://example.com/error-log/abc123

statusinteger<int64>

HTTP status code

Example:400

titlestring

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

Example:Bad Request

typestring<uri>

A URI reference to human-readable documentation for the error.

Default:about:blank

Example:https://example.com/errors/example

Previous

qan_getFilterLogs

Next

qan_getProof