> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.galleon8.com/api-reference/advanced-api/api-endpoints/query-api/ankr-get-blocks/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.galleon8.com/_mcp/server. # ankr_getBlocks POST https://advanced-api-docs-proxy.galleon8.workers.dev Content-Type: application/json Retrieves details of the specified range of blocks. Reference: https://docs.galleon8.com/api-reference/advanced-api/api-endpoints/query-api/ankr-get-blocks ## Request ### Body (application/json) This endpoint expects an object. - `blockchain` (enum, required) — Name of the blockchain. - Allowed values: `arbitrum`, `avalanche`, `avalanche_fuji`, `bsc`, `eth`, `eth_goerli`, `fantom`, `optimism`, `polygon`, `polygon_mumbai`, `polygon_zkevm`, `syscoin` - `decodeLogs` (boolean, optional) — Decode logs (true) or not (false). - `decodeTxData` (boolean, optional) — Decode transaction data (true) or not (false). - `descOrder` (boolean, optional) — Sorting order. Descending (true) or ascending (false). - `fromBlock` (BlockRangeValue, optional) — Number of the first block in a range. Integer or string (hex value or earliest). Max range — 30 blocks. - `includeLogs` (boolean, optional) — Include logs (true) or exclude them (false). Logs are stored inside transactions, so includeTxs also has to be true when includeLogs is true. - `includeTxs` (boolean, optional) — Include transactions (true) or exclude them (false). includeTxs has to be true if includeLogs is true. - `toBlock` (BlockRangeValue, optional) — Number of the last block in a range. Integer or string (hex value or latest). Max range — 30 blocks. ## Response ### 200 Result returned by ankr_getBlocks. - `blocks` (list of AnkrGetBlocksResultBlocksItems, optional, nullable) ## Types ### BlockRangeValue Block number, hex block number, latest, or earliest. ### AnkrGetBlocksResultBlocksItems - `blockchain` (enum, required) — Supported blockchain identifier. - Allowed values: `arbitrum`, `avalanche`, `avalanche_fuji`, `bsc`, `eth`, `eth_goerli`, `fantom`, `optimism`, `polygon`, `polygon_mumbai`, `polygon_zkevm`, `syscoin` - `difficulty` (string, required) — Integer of the difficulty for this block encoded as a hexadecimal. - `extraData` (string, required) — Extra data of the block. - `gasLimit` (string, required) — Maximum gas allowed in this block. - `gasUsed` (string, required) — Total used gas by all transactions in this block. - `hash` (string, required) — Hash of the block. Null if pending. - `logsBloom` (string, required) — Bloom filter for the logs of the block. Null if pending. - `miner` (string, required) — Address of the beneficiary the mining rewards for the block were given to. - `mixHash` (string, required) — String of a 256-bit hash encoded as a hexadecimal. - `nonce` (string, required) — Hash of the generated proof-of-work. Null if pending. - `number` (string, required) — Block number encoded as a hexadecimal. Null if pending. - `parentHash` (string, required) — Hash of the parent block. - `receiptsRoot` (string, required) — Root of the receipts trie of the block. - `sha3Uncles` (string, required) — SHA3 of the uncles data in the block. - `size` (string, required) — Size of the block, in bytes. - `stateRoot` (string, required) — Root of the final state trie of the block - `timestamp` (string, required) — UNIX timestamp when the block was collated. - `totalDifficulty` (string, required) — Integer of the total difficulty of the chain until this block. - `transactions` (list of AnkrGetBlocksResultBlocksItemsTransactionsItems, required, nullable) - `transactionsRoot` (string, required) — Root of the transaction trie of the block. - `uncles` (list of any, required, nullable) ### AnkrGetBlocksResultBlocksItemsTransactionsItems - `blockHash` (string, required) — Hash of the block that included the transaction. Null if pending. 32 bytes. - `blockNumber` (string, required) — Block number where the transaction was included. Null if pending. - `blockchain` (enum, required) — Supported blockchain identifier. - Allowed values: `arbitrum`, `avalanche`, `avalanche_fuji`, `bsc`, `eth`, `eth_goerli`, `fantom`, `optimism`, `polygon`, `polygon_mumbai`, `polygon_zkevm`, `syscoin` - `from` (string, required) — Blockchain address, ENS name, or contract address where supported. - `status` (string, required) — Status of the transaction. 1 (success) or 0 (failure). - `timestamp` (string, required) — UNIX timestamp when the block was collated. - `to` (string, required, nullable) — Blockchain address, ENS name, or contract address where supported. - `transactionIndex` (string, required) — Index position of the transaction in the block. Null if pending. - `value` (string, required) — Value transferred. Encoded as hexadecimal. - `contractAddress` (string, optional) — Blockchain address, ENS name, or contract address where supported. - `cumulativeGasUsed` (string, optional) — Total amount of gas used when this transaction was executed in the block. - `gas` (string, optional) — Gas provided by the sender. - `gasPrice` (string, optional) — Gas price provided by the sender. Encoded as hexadecimal. - `gasUsed` (string, optional) — Total used gas by all transactions in this block. - `hash` (string, optional) — Hash of the transaction. 32 bytes. - `input` (string, optional) — Data sent along with the transaction. - `logs` (list of AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItems, optional) — Array of log objects that the transaction generated. - `method` (AnkrGetBlocksResultBlocksItemsTransactionsItemsMethod, optional) — Name of the method if the transaction was sent to a contract. Empty if no contract. - `nonce` (string, optional) — Total number of transactions ever sent by the sender prior to this transaction. Encoded as hexadecimal. - `r` (string, optional) — R field of the signature. - `s` (string, optional) — S field of the signature. - `type` (string, optional) — Type of the transaction. - `v` (string, optional) — Standardized V field of the signature. ### AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItems - `address` (string, required) — Blockchain address, ENS name, or contract address where supported. - `blockHash` (string, required) — Hash of the block that included the log. Null when pending. - `blockNumber` (string, required) — Block number where the log was included. Null when pending. - `blockchain` (enum, required) — Supported blockchain identifier. - Allowed values: `arbitrum`, `avalanche`, `avalanche_fuji`, `bsc`, `eth`, `eth_goerli`, `fantom`, `optimism`, `polygon`, `polygon_mumbai`, `polygon_zkevm`, `syscoin` - `data` (string, required) — One or more 32B non-indexed arguments of the log. - `logIndex` (string, required) — Index position of the log in the block. Null when pending. - `removed` (boolean, required) — Status of the log. True when the log was removed due to a chain reorganization, and false if it's a valid log. - `topics` (list of string, required, nullable) - `transactionHash` (string, required) — Hash of the transaction that created the log. Null when pending. - `transactionIndex` (string, required) — Index position of the transaction that created the log. Null when pending. - `event` (AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItemsEvent, optional) — Metadata of the log. ### AnkrGetBlocksResultBlocksItemsTransactionsItemsMethod Name of the method if the transaction was sent to a contract. Empty if no contract. - `id` (string, optional) — Hashed signature of the called method. - `inputs` (list of AnkrGetBlocksResultBlocksItemsTransactionsItemsMethodInputsItems, optional, nullable) - `name` (string, optional) — Name of the called contract method. - `signature` (string, optional) — Signature of the called method. - `string` (string, optional) — String containing signature of the called method. - `verified` (boolean, optional) — Status of the contract. Verified (true) or not verified (false). ### AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItemsEvent Metadata of the log. - `anonymous` (boolean, optional) — Anonymous event (true) or not (false). - `id` (string, optional) — Hash of the event signature. - `inputs` (list of AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItemsEventInputsItems, optional, nullable) - `name` (string, optional) — Name of the event. - `signature` (string, optional) — Signature of the event. - `string` (string, optional) — String containing signature of the event. - `verified` (boolean, optional) — Status of the contract. Verified (true) or not verified (false). ### AnkrGetBlocksResultBlocksItemsTransactionsItemsMethodInputsItems - `name` (string, optional) — Name of the input parameter. - `size` (integer, optional) — Size of the parameter, in bytes. - `type` (string, optional) — Type of the input parameter. - `valueDecoded` (string, optional) — Decoded value of the parameter (unmarshalled). ### AnkrGetBlocksResultBlocksItemsTransactionsItemsLogsItemsEventInputsItems - `indexed` (boolean, optional) — Indexed event input (true) or non-indexed (false). - `name` (string, optional) — Name of the input. - `size` (integer, optional) — Size of the event input. - `type` (string, optional) — Type of the input. - `valueDecoded` (string, optional) — Decoded value of the event input (unmarshalled). ## Examples **Request** ```json [ "eth", false, false, false, 20300000, false, true, 20300000 ] ``` **SDK Code** ```python import requests url = "https://advanced-api-docs-proxy.galleon8.workers.dev/" payload = ["eth", False, False, False, 20300000, False, True, 20300000] headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://advanced-api-docs-proxy.galleon8.workers.dev/'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '["eth",false,false,false,20300000,false,true,20300000]' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://advanced-api-docs-proxy.galleon8.workers.dev/" payload := strings.NewReader("[\n \"eth\",\n false,\n false,\n false,\n 20300000,\n false,\n true,\n 20300000\n]") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://advanced-api-docs-proxy.galleon8.workers.dev/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "[\n \"eth\",\n false,\n false,\n false,\n 20300000,\n false,\n true,\n 20300000\n]" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://advanced-api-docs-proxy.galleon8.workers.dev/") .header("Content-Type", "application/json") .body("[\n \"eth\",\n false,\n false,\n false,\n 20300000,\n false,\n true,\n 20300000\n]") .asString(); ``` ```php request('POST', 'https://advanced-api-docs-proxy.galleon8.workers.dev/', [ 'body' => '[ "eth", false, false, false, 20300000, false, true, 20300000 ]', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://advanced-api-docs-proxy.galleon8.workers.dev/"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "[\n \"eth\",\n false,\n false,\n false,\n 20300000,\n false,\n true,\n 20300000\n]", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["eth", false, false, false, 20300000, false, true, 20300000] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://advanced-api-docs-proxy.galleon8.workers.dev/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```