EthereumMethods

eth_getUncleCountByBlockNumber

The eth_getUncleCountByBlockNumber method returns the number of uncles in a block from a block matching the given block number.

eth_getUncleCountByBlockNumber

Overview

The 'eth_getUncleCountByBlockNumber' method returns the number of uncles in a block from a block matching the given block number.

Request

shell

curl --request POST \
     --url https://ethereum-mainnet-geth-archive.node.coinapi.io \
     --header 'accept: application/json'
     --header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
{
  "id": 1,
  "jsonrpc": "2.0",
  "params": [
    "0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8",
    "latest"
  ],
  "method": "eth_getUncleCountByBlockNumber"
}'

csharp

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");
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content); }

php

<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://ethereum-mainnet-geth-archive.node.coinapi.io",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"X-CoinAPI-Key": "73034021-THIS-IS-SAMPLE-KEY"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>

python

import requests

url = "https://ethereum-mainnet-geth-archive.node.coinapi.io"

headers = {"accept": "application/json","X-CoinAPI-Key" : "73034021-THIS-IS-SAMPLE-KEY"}

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

print(response.text)

javascript

const options = {method: 'POST', headers: {accept: 'application/json'}};

fetch('https://ethereum-mainnet-geth-archive.node.coinapi.io', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

go

package main

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

func main() {

	url := "https://ethereum-mainnet-geth-archive.node.coinapi.io"

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

	req.Header.Add("accept", "application/json")
  req.Header.Add("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")


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

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

	fmt.Println(string(body))

}

ruby

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["X-CoinAPI-Key"] = '73034021-THIS-IS-SAMPLE-KEY'

response = http.request(request)
puts response.read_body

java

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://ethereum-mainnet-geth-archive.node.coinapi.io")
  .post(null)
  .addHeader("accept", "application/json")
  .addHeader("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")
  .build();

Response response = client.newCall(request).execute();

Request Parameters

  • 'Block Parameter' [ Required ]: A hexadecimal block number, or the string latest, earliest or pending. See the default block parameter.

Response

Block Uncle Count: A hexadecimal equivalent of the integer representing the number of uncles in the block.

Service StatusGitHub SDK