qan_getBlockByNumber
https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/
API details
Returns information of the block matching the given block number.
Parameters for "qan_getBlockByNumber"
The block number in hexadecimal or decimal format or the string latest, earliest, pending
The method returns the full transaction objects when this value is true otherwise, it returns only the hashes of the transactions
HTTP response status codes for "qan_getBlockByNumber"
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
404 | Not Found |
422 | Unprocessable Entity |
500 | Internal Server Error |
Code samples for "qan_getBlockByNumber"
Request examples
https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/
curl --request GET \
--url https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/ \
--header 'Accept: application/json, application/problem+json'
const options = {method: 'GET', headers: {Accept: 'application/json, application/problem+json'}};
fetch('https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept", "application/json, application/problem+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/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/"
headers = {"Accept": "application/json, application/problem+json"}
response = requests.get(url, headers=headers)
print(response.text)
HttpResponse<String> response = Unirest.get("https://rpc-testnet.qanplatform.com/getBlockByNumber/{BlockNumber}/{TransactionDetailFlag}/")
.header("Accept", "application/json, application/problem+json")
.asString();
Responses
Description: OK
Content type: application/json
Example
{
"$schema": "https://rpc-testnet.qanplatform.com/schemas/Output_getBlockByNumber.json",
"Block": {}
}
Body
A URL to the JSON Schema for this object.
Example:https://rpc-testnet.qanplatform.com/schemas/Output_getBlockByNumber.json
A block object, or null when no block was found
A string of the base fee encoded in decimal format. Please note that this response field will not be included in a block requested before the EIP-1559 upgrade
The integer of the difficulty for this block encoded as a decimal
The “extra data” field of this block
The maximum gas allowed in this block encoded as a decimal
The total used gas by all transactions in this block encoded as a decimal
The block hash of the requested block. null if pending
The bloom filter for the logs of the block. null if pending
The address of the beneficiary to whom the mining rewards were given
A string of a 256-bit hash encoded as a decimal
The hash of the generated proof-of-work. null if pending
The block number of the requested block encoded as a decimal. null if pending
The hash of the parent block
The root of the receipts trie of the bloc
The SHA3 of the uncles data in the block
The size of this block in bytes as an Integer value encoded as decimal
The root of the final state trie of the block
The unix timestamp for when the block was collated
The integer of the total difficulty of the chain until this block encoded as a decimal
An array of transaction objects - please see getTransactionByHash for exact shape
A list of addresses and storage keys that the transaction plans to access
The hash of the block where this transaction was in. Null when it's a pending transaction
The block number where this transaction was in. Null when it's a pending transaction
The chain id of the transaction, if any
The address of the sender
The gas provided by the sender, encoded as decimal
The gas price provided by the sender in wei encoded as decimal
The hash of the transaction
The data sent along with the transaction
The maximum fee per gas set in the transaction
The maximum priority gas fee set in the transaction
The number of transactions made by the sender prior to this one encoded as decimal
The R field of the signature
The S field of the signature
The address of the receiver. Null when its a contract creation transaction
The integer of the transaction's index position that the log was created from. Null when it's a pending log
The transaction type
The standardized V field of the signature
The value transferred in wei encoded as decimal
The root of the transaction trie of the block
An array of uncle hashes
A withdrawals object contains information about withdrawals made by validators. Please note that this field will not be included in a block requested before the EIP-4895 upgrade
The address to which the withdrawn amount is sent
The amount of value, provided in decimal format, corresponding to a certain value in gwei
The index of the withdrawal to uniquely identify each withdrawal
The index of the validator who initiated the withdrawal
The Merkle root of withdrawal data. Also, please note that this field will not be included in a block requested before the EIP-4895 upgrade
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
A URL to the JSON Schema for this object.
Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json
A human-readable explanation specific to this occurrence of the problem.
Example:Property foo is required but is missing.
Optional list of individual error details
Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
Example:https://example.com/error-log/abc123
HTTP status code
Example:400
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Example:Bad Request
A URI reference to human-readable documentation for the error.
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
A URL to the JSON Schema for this object.
Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json
A human-readable explanation specific to this occurrence of the problem.
Example:Property foo is required but is missing.
Optional list of individual error details
Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
Example:https://example.com/error-log/abc123
HTTP status code
Example:400
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Example:Bad Request
A URI reference to human-readable documentation for the error.
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
A URL to the JSON Schema for this object.
Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json
A human-readable explanation specific to this occurrence of the problem.
Example:Property foo is required but is missing.
Optional list of individual error details
Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
Example:https://example.com/error-log/abc123
HTTP status code
Example:400
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Example:Bad Request
A URI reference to human-readable documentation for the error.
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
A URL to the JSON Schema for this object.
Example:https://rpc-testnet.qanplatform.com/schemas/ErrorModel.json
A human-readable explanation specific to this occurrence of the problem.
Example:Property foo is required but is missing.
Optional list of individual error details
Where the error occurred, e.g. 'body.items3.tags' or 'path.thing-id'
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
Example:https://example.com/error-log/abc123
HTTP status code
Example:400
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Example:Bad Request
A URI reference to human-readable documentation for the error.
Example:https://example.com/errors/example