eth_getUncleByBlockHashAndIndex
Overview
The 'eth_getUncleByBlockHashAndIndex' method returns information about a uncle of a block given the block hash and the uncle index position.
Request
- shell
- csharp
- php
- python
- javascript
- go
- ruby
- java
curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [
"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8",
"latest"
],
"method": "eth_getTransactionCount"
}'
using RestSharp; {
var options = new RestClientOptions("https://ethereum-mainnet-geth-archive.node.coinapi.io");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json","X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY");
request.AddJsonBody("{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getTransactionCount\"}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content); }
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://eth-mainnet.g.alchemy.com/v2/docs-demo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'params' => [
'0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8',
'latest'
],
'method' => 'eth_getTransactionCount'
]),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
import requests
url = "https://ethereum-mainnet-geth-archive.node.coinapi.io"
payload = {
"id": 1,
"jsonrpc": "2.0",
"params": ["0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8", "latest"],
"method": "eth_getTransactionCount"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"X-CoinAPI-Key" : "73034021-THIS-IS-SAMPLE-KEY"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {accept: 'application/json', 'content-type': 'application/json', 'X-CoinAPI-Key': '73034021-THIS-IS-SAMPLE-KEY'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
params: ['0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8', 'latest'],
method: 'eth_getTransactionCount'
})
};
fetch('https://ethereum-mainnet-geth-archive.node.coinapi.io', 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://eth-mainnet.g.alchemy.com/v2/docs-demo"
payload := strings.NewReader("{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getTransactionCount\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("accept", "application/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))
}
require 'uri'
require 'net/http'
url = URI("https://ethereum-mainnet-geth-archive.node.coinapi.io")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["X-CoinAPI-Key"] = '73034021-THIS-IS-SAMPLE-KEY'
request.body = "{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getTransactionCount\"}"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getTransactionCount\"}");
Request request = new Request.Builder()
.url("https://eth-mainnet.g.alchemy.com/v2/docs-demo")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
Request Parameters
- 'block hash': [ Required ] A string representing the hash (32 bytes) of a block.
- 'uncle index position': [ Required ] A hexadecimal equivalent of the integer indicating the uncle's index position
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
A block object, or null when no block was found. The block object returned will consist of the following keys and their values:
- number: The block number. Null when the returned block is the pending block.
- hash: 32 bytes. Hash of the block. Null when it's a pending block.
- parentHash: 32 bytes. Hash of the parent block.
- nonce: 8 bytes. Hash of the generated proof-of-work. Null when the returned block is the pending block.
- sha3Uncles: 32 bytes. The SHA3 of the uncles data in the block.
- logsBloom: 256 bytes. The Bloom filter for the logs of the block. Null when the returned block is the pending block.
- transactionsRoot: 32 bytes. The root of the transaction trie of the block.
- stateRoot: 32 bytes. The root of the final state trie of the block.
- receiptsRoot: 32 bytes. The root of the receipts trie of the block.
- miner: 20 bytes. The address of the beneficiary to whom the mining rewards were given.
- difficulty: The hexadecimal of the difficulty for this block.
- totalDifficulty: The hexadecimal of the total difficulty of the chain until this block.
- extraData: The "extra data" field of this block.
- size: The hexadecimal of the size of this block in bytes.
- gasLimit: Maximum gas allowed in this block.
- gasUsed: Total used gas by all transactions in this block.
- timestamp: The unix timestamp for when the
Was this section helpful?