EthereumMethods

eth_getUncleCountByBlockHash

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

eth_getUncleCountByBlockHash

Overview

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

Request

curl


curl https://ethereum-mainnet-quicknode.node.coinapi.io/apikey-XXX/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getUncleCountByBlockHash","params":["0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b"],"id":1,"jsonrpc":"2.0"}'

python


import requests
import json

url = "curl https://ethereum-mainnet-quicknode.node.coinapi.io/apikey-XXX/"

payload = json.dumps({
  "method": "eth_getUncleCountByBlockHash",
  "params": [
    "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b"
  ],
  "id": 1,
  "jsonrpc": "2.0"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

ruby


require "uri"
require "json"
require "net/http"

url = URI("https://ethereum-mainnet-quicknode.node.coinapi.io/apikey-XXX/")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "method": "eth_getUncleCountByBlockHash",
  "params": [
    "0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b"
  ],
  "id": 1,
  "jsonrpc": "2.0"
})

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

Request Parameters

  • block hash: [ Required ] A string representing the hash (32 bytes) of a block.

Response

{
  "jsonrpc":"2.0",
  "id":1,
  "result":"0x0"
}
  • block uncle count: A hexadecimal equivalent of the integer representing the number of uncles in the block.
Service StatusGitHub SDK